Matlab Error "X, Y, Z, and C cannot be complex"
2 views (last 30 days)
Show older comments
Nikolas Spiliopoulos
on 15 Jul 2020
Answered: Walter Roberson
on 15 Jul 2020
Hi all,
I am trying to plot a surface however, I get an error "X, Y, Z, and C cannot be complex." which means, apparently there are some xomplex values. However, I put the command to get only the real values and I get a blank graph with no points at all (it is obvious that there are solutions with real values). Couod you help me with that? here is the code
a=0.1735;
b=0.19;
c=0.3283;
d=-0.017;
[I,I_opt] = meshgrid(0.1:0.1:4.67,0.1:0.1:4.67);
Z=exp(0.3524*(I-I_opt))*a*exp(b*I)*(1-a*exp(b*I))/(c*I_opt^d*(1-c*I_opt^d));
redChannel=Z<1;
colors = double(redChannel);
surf(I,I_opt,real(Z),colors)
zlim([0 10])
0 Comments
Accepted Answer
Walter Roberson
on 15 Jul 2020
>> Z=exp(0.3524.*(I-I_opt)).*a.*exp(b.*I).*(1-a.*exp(b.*I))./(c.*I_opt.^d.*(1-c.*I_opt.^d));
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!