Matlab Error "X, Y, Z, and C cannot be complex"

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

采纳的回答

Walter Roberson
Walter Roberson 2020-7-15
>> 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 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by