Problem with the 2D-plot of a function

1 visualizzazione (ultimi 30 giorni)
Hello everybody,
i tried to plot a function. In it's final form, the only parameter of this function is "x".
When i try to plot this function, i get an error. Can you guys tell me where the problem is?
So lets say this is my function:
Varg_hat =
(1497527781869391849*x^2*exp(2*(-x*exp(-41/10))^(9/5))*exp(-41/5)*(-x*exp(-41/10))^(8 /5))/720575940379279360 + (232324954970675913*x*exp(2*(-x*exp(-41/10))^(9/5))*exp(-41/10)*log(-x*exp(-41 /10))*(-x*exp(-41/10))^(13/5))/720575940379279360
Now i want to plot this, by calculating this function for x-values from lets say 0 to 350 in 0.1-steps.
How can i do this?
I tried for example:
x=0:0.1:350;
plot(x,Varg_hat)
But then Matlab says:
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
Thank you for taking time to look over my question.
Sincerly, Ronald Singer

Risposta accettata

Walter Roberson
Walter Roberson il 16 Ott 2017
syms x;
Varg_hat = (1497527781869391849*x^2*exp(2*(-x*exp(-41/10))^(9/5))*exp(-41/5)*(-x*exp(-41/10))^(8 /5))/720575940379279360 + (232324954970675913*x*exp(2*(-x*exp(-41/10))^(9/5))*exp(-41/10)*log(-x*exp(-41 /10))*(-x*exp(-41/10))^(13/5))/720575940379279360;
x=0:0.1:350;
y = double(subs(Varg_hat));
plot(x,real(y),'k', x,imag(y),'r')

Più risposte (0)

Categorie

Scopri di più su Mining Geology in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by