数据类型转换?

时间:2019-01-19 00:10:37

标签: matlab plot types matlab-coder

给出矩阵形式的微分方程:

{
    "Version": "2012-10-17",
    "Id": "Policy-S3-Bucket-myBucket",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListAllMyBuckets"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:username": ["user1", "user2"]
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": ["s3:ListBucket"],
            "Resource": ["arn:aws:s3:::myBucket"],
            "Condition": {
                "StringEquals": {
                    "aws:sourceVpc": "vpc-01c9d66c12345"
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": ["s3:ListBucket"],
            "Resource": ["arn:aws:s3:::myBucket"],
            "Condition": {
                "StringEquals": {
                    "aws:username": ["user1", "user2"]
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject"
            ],
            "Resource": ["arn:aws:s3:::myBucket/*"],
            "Condition": {
                "StringEquals": {
                    "aws:sourceVpc": "vpc-01c9d66c12345"
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject"
            ],
            "Resource": ["arn:aws:s3:::myBucket/*"],
            "Condition": {
                "StringEquals": {
                    "aws:username": ["user1", "user2"]
                }
            }
        }
    ]
}

我的微分方程问题的解决方案是

f = @(t,y) [(a*y(1) + b*y(2)); (c*y(1) + d*y(2))];
a=-2; b=-1; c=1; d=-4

常规解决方案是

x(t)= e^(-3t) (t+1)
y{t)= e^(-3t) *t 

初始条件为(xo,yo)=(1,0)=(e; g)

Matlab代码:

Y(t)=  e^(-3t) (xo,yo)' + t * e^(-3t) (xo-yo,xo-yo)'

错误消息:

syms xSol ySol  ran with and without this statement with same error msg
t=-1.1:0.1:2.1;
plot(t,xSol)  error occurs here
hold on
plot(t,ySol)
hold off

进一步的研究表明,xSol和ySol必须是数字。 我处于初始状态(1; 0);

Error using plot
Data must be numeric, datetime, duration or an array convertible to double.

我需要将xSol(t)和ySol(t)更改为不带(t)的xSol和ySol。 怎么修?校正必须适用于复数。

在线示例使用fplot。在此应用程序中使用更好的功能吗? 我需要为xSolv和ySolv定义两个函数。我的代码适用于两个变量的通用微分方程。

在线示例为

xSol(t) = exp(-3*t) + t*exp(-3*t)
ySol(t) = t*exp(-3*t)

假设我们想将其绘制在0.01和1之间:

f = @(x) sin(1/x);

我尝试过

lims = [.01 1];
fplot(f, lims, '.-')

但情节错误。这令人不安。没有错误。

怎么办?

MM

1 个答案:

答案 0 :(得分:0)

更改语法可以很好地纠正错误,现在可以绘制正确的图了。

<dependencies>
<dependency>
  <groupId>org.openjfx</groupId>
  <artifactId>javafx-controls</artifactId>
  <version>11</version>
</dependency>
<dependency>
  <groupId>org.openjfx</groupId>
  <artifactId>javafx-fxml</artifactId>
  <version>11</version>
</dependency>