plot an obtained function after several calculus

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)
Unrecognized function or variable 'a'.
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 commentaires

L.GREEN
L.GREEN le 4 Août 2024
Modifié(e) : L.GREEN le 4 Août 2024
I tried also the following code , i got an error message:
Error using arrayfun
sym output type is not supported. Set 'UniformOutput' to false.
F=@(t) Y
figure(2)
hold on
Fnum = arrayfun(@(t)F(t),t_vals);
plot(t_vals,Fnum)
grid on
hold off
Torsten
Torsten le 4 Août 2024
Modifié(e) : Torsten le 4 Août 2024
You did not yet tell us what the problem is with your code. The evaluation for one value for t already lasts too long to be executed here. Is the problem the long time it takes on your PC ?
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);
double(subs(Y,t,1))
L.GREEN
L.GREEN le 4 Août 2024
I let my PC run, it's been 15 minutes and i still don't have the result.
Torsten
Torsten le 4 Août 2024
Modifié(e) : Torsten le 4 Août 2024
I think you must change your strategy ...
Cut the expression into pieces. Use numerical instead of symbolic integration whereever possible.
L.GREEN
L.GREEN le 4 Août 2024
Ok, that you for your help.
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()

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Produits

Version

R2015a

Question posée :

le 4 Août 2024

Modifié(e) :

le 4 Août 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by