t=1;
R1=1;
R0=10;
w=(0.001:0.001:1000)
log10w=log10(w)
a1=0.25;
a2=0.5;
a3=0.75;
a4=1;
c1=cos((a1*pi)/2);
s1=sin((a1*pi)/2);
ModZ1=sqrt((R1^2.*(w*t)).^2*a1+2*c1*R0*R1.*(w*t).^a1+R0^2)./(1+2*c1.*(w*t).^a1+(w*t).^2*a1);
c2=cos((a2*pi)/2);
s2=sin((a2*pi)/2);
ModZ2=sqrt((R1^2.*(w*t)).^2*a2+2*c1*R0*R1.*(w*t).^a2+R0^2)./(1+2*c1.*(w*t).^a2+(w*t).^2*a2);
c3=cos((a3*pi)/2);
s3=sin((a3*pi)/2);
ModZ3=sqrt((R1^2.*(w*t)).^2*a3+2*c1*R0*R1.*(w*t).^a3+R0^2)./(1+2*c1.*(w*t).^a3+(w*t).^2*a3);
c4=cos((a4*pi)/2);
s4=sin((a4*pi)/2);
ModZ4=sqrt((R1^2.*(w*t)).^2*a4+2*c1*R0*R1.*(w*t).^a4+R0^2)./(1+2*c1.*(w*t).^a4+(w*t).^2*a4);
plot(log10w,ModZ1,'k')
hold on
plot(log10w,ModZ2,'y');
plot(log10w,ModZ3,'b');
plot(log10w,ModZ4,'m');
xlabel('log10w');
ylabel('|Z|')
When I press run it says "undefined function of variable "modulus" ?

3 Kommentare

Madara Hettigama
Madara Hettigama am 6 Nov. 2019
Bearbeitet: Madara Hettigama am 6 Nov. 2019
Basically I need a graphical plot - i'm not sure where the error is
per isakson
per isakson am 6 Nov. 2019
Bearbeitet: per isakson am 6 Nov. 2019
Your code runs and creates a plot without problems on R2018b.
Run
dbstop if error
before running your script
And see
Walter Roberson
Walter Roberson am 6 Nov. 2019
I do not encounter any difficulty in running that code. Other than the fact that you really really should put a semi-colon on the end of the assignments to w and log10w because your vectors are quite long.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jeremy
Jeremy am 6 Nov. 2019

0 Stimmen

Your script runs for me as-is

3 Kommentare

Madara Hettigama
Madara Hettigama am 6 Nov. 2019
Bearbeitet: Madara Hettigama am 6 Nov. 2019
Im trying to plot in 4d so i need the graph but it keeps coming up with that message
clear all
dbstop if error
then run your code, and tell us exactly where it stops. The output of
dbstack
would help.
Madara Hettigama
Madara Hettigama am 7 Nov. 2019
It's fine now I think- I clicked run section and graph came up, thank you.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Debugging and Analysis finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 6 Nov. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by