Trouble using ezplot and matlabFunction on a symbolic function defined using symengine "piecewise"
显示 更早的评论
syms x t;
MP_syntax1 = 'piecewise([x <= 10, x/10], [10 < x <= 30, (30 - x)/20])';
MP_syntax2 = 'ilaplace(2/s^3,s,t)';
f(x) = evalin(symengine,MP_syntax1);
g(t) = evalin(symengine,MP_syntax2);
No trouble with g(t) or other MuPad functions:
ezplot(g(t), [-5,5]);
G = matlabFunction(g(t));
Trying the same to the piecewise, f(x) will not work however.
ezplot(f(x),[0,30]);
F = matlabFunction(f(x));
However, this works
xd = 0:0.1:30;
fd = double(f(xd));
plot(xd,fd);
What is wrong with the other calls using ezplot and matlabFunction for f(x) ?
4 个评论
Geoff Hayes
2015-3-29
Ronny - what do you mean by f(x) will not work? Are you observing an error or something else?
Ronny Landsverk
2015-3-30
Vishal Tripathi
2016-3-3
I am having a similar error. Any solution yet?
Sarah Palfreyman
2016-3-7
Try the new fplot family of functions in R2016a.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
