필터 지우기
필터 지우기

What am I doing wrong here? I am trying to recreate following highlighted equations in the table.

조회 수: 1 (최근 30일)
ep = linspace(0,1);
m1 = 1.5; m2 = 3.8;
ep0= 1; alpha = 0.785; epp = 0.11;
qep = (2.76*ep*cosh((3*ep)-1.92));
I1 = ep.^ m1;
I2 = ep.^ m2;
I3 = ep*((ep-epp)/(ep0-epp)).^alpha;
I6 = 1-(qep*((3*(1-ep))/(3-ep)));
Hold on
plot(ep,I1)
plot(ep,I2)
plot(ep,I3)
plot(ep,I6)
Hold off

채택된 답변

Paul Hoffrichter
Paul Hoffrichter 2021년 3월 27일
편집: Paul Hoffrichter 2021년 3월 27일
clc; clear; clf
ep = linspace(0,1);
m1 = 1.5; m2 = 3.8;
ep0= 1; alpha = 0.785; epp = 0.11;
qep = (2.76*ep.*cosh((3*ep)-1.92));
I1 = ep.^ m1;
I2 = ep.^ m2;
zz = (ep-epp)/(ep0-epp);
zza = zz .^ alpha; % zza is complex
I3 = ep .* zza;
I6 = 1-(qep*((3*(1-ep))/(3-ep)));
hold on
plot(ep,I1);
plot(ep,I2)
plot(ep,I3) % This is Line 18 - usually do not plot a complex vector like this
plot(ep,I6)
hold off
warning:
Warning: Imaginary parts of complex X and/or Y arguments ignored.
> In Untitled (line 18)
  댓글 수: 4
Nissal Arachchige
Nissal Arachchige 2021년 3월 27일
No not at all. I was actually able to recognize my coading problem before you posted the answer and I got the same solution as you and the warning as well. I do not know why it does that. And I was supposed to recreate the follwing graph but ignore the points and the legend. I'm waiting for the feedback from my professor. I'll let you know if something intresting come up. Thanks again.
Paul Hoffrichter
Paul Hoffrichter 2021년 3월 28일
I was a surprised at first about the complex numbers. But then I thought about what if alpha was 0.5 instead of 0.785. Then if x is a negative number, we have a purely imaginary result for x^(.5)=sqrt(x)= sqrt{(-1) * abs(x)} = 0 + j*sqrt(abs(x)). For other values of alpha between (0.5, 1.0), we get complex numbers.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by