dsolve图

时间:2016-12-20 19:43:35

标签: matlab function dsolve

如何绘制以下功能?我需要x范围[0; 1]

syms y(x)
y(x) = dsolve(diff(y,x) == tan(x), y(0) == 1);
plot(y, [0 1]);

1 个答案:

答案 0 :(得分:0)

您收到的错误消息是:

  

使用绘图时出错   
'Line'

不支持非数字数据

这确切地说明了问题所在。此处y 不是数字数据。相反,它是一种象征性的功能。您需要在所需的点评估y,然后绘制它。

固定代码:

syms y(x)
y(x) = dsolve(diff(y,x) == tan(x), y(0) == 1);
x=0:0.01:1;
plot(x,y(x));

<强>输出:

output

相关问题