plot an obtained function after several calculus
8 次查看(过去 30 天)
显示 更早的评论
Good morning!
I want to plot the folloing function which is obtained after several calculus on Matlab,
syms s t a
Y=(sin(int(cos((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/9))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/18)))^2/100)^2*(exp(-2*s^(1/3)) + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s^(2/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/6)))^2/100)^2)^2, s, 0, 1))/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/18))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/36)))^2/100)*(exp(-2*t^(1/6)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t^(1/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100))^2/100)*(exp(-2*t) + cos(int(sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/12)))^2/100)*(exp(-2*s^(1/2)) + sin(0.00008414709848078965066525023216303*cos(s^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/4)))^2/100 + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s))^2/100)) + 1, s, 0, t^2))^2/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100)*(exp(-2*t^(1/2)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/4)))^2/100))^2/100)
in this function another variable appeared (denoted by ' a' ) so i add it in symbolique variable
To plot this function i used the folowing code:
t_vals=linspace(0, 1, 10);
figure(1)
hold on
y_eval = double(eval(subs(Y(i+1),t, t_vals)))
plot(t_vals, y_eval;
hold off
6 个评论
Walter Roberson
2024-8-4
y_eval = double(eval(subs(Y(i+1),t, t_vals)))
You should never eval() a symbolic result. eval() of a symbolic result has no documented meaning.
In practice, eval() of a symbolic result is the same as eval() of char() of the symbolic result. The problem with that is that char() of symbolic results produces something that is not in MATLAB expression format and is not in MuPAD internal code: char() of symbolic results is intended to be human readable, and is not intended for machine processing.
What you need to do instead is perform all necessary subs() on the expression, and then double() the result without using eval()
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!