Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何绘制以下函数?我需要 x 范围的[0; 1].
[0; 1]
syms y(x) y(x) = dsolve(diff(y,x) == tan(x), y(0) == 1); plot(y, [0 1]);
您收到的错误消息是:
使用绘图时出错 “行”中不支持非数字数据
这准确地说明了问题所在。y这里不是数字数据。相反,它是一个象征性的功能。您需要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));
输出: