No line on my graph

2 views (last 30 days)
Sakusan Puwanendran
Sakusan Puwanendran on 5 Nov 2017
Edited: VBBV on 22 Sep 2021
I tried plotting modz as a function of log10w but there is no line on my graph w=0.001:1000 modz=sqrt((w.^0.5 + 20*cos(pi/8)*w.^0.25 + 100)/(1+ 2*cos(pi/8)*w.^0.25 +w.^0.5)) W=log10(w) figure(3) plot(W,modz)

Answers (2)

Star Strider
Star Strider on 5 Nov 2017
You need to vectorise (do element-wise calculations) in your ‘modz’ calculation. This means substituting ‘./’ for /:
modz=sqrt((w.^0.5 + 20*cos(pi/8)*w.^0.25 + 100)./(1+ 2*cos(pi/8)*w.^0.25 +w.^0.5));
That will work.

VBBV
VBBV on 22 Sep 2021
Edited: VBBV on 22 Sep 2021
w=0.001:1000;
modz=sqrt((w.^0.5 + 20*cos(pi/8)*w.^0.25 + 100)./(1+ 2*cos(pi/8)*w.^0.25 +w.^0.5));
W=log10(w);
figure(3) ;
plot(W,modz)
Use the element division operator

Tags

Community Treasure Hunt

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

Start Hunting!