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

조회 수: 2 (최근 30일)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020년 7월 15일
답변: Walter Roberson 2020년 7월 15일
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