Problem with the 2D-plot of a function

1 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2017-10-16
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')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mining Geology 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by