Attempting to Plot atand function and nothing appears in plot, any suggestions?
2 次查看(过去 30 天)
显示 更早的评论
w0 = 1;
w = [0:1:50];
q0 = 1;
y = 20*log10(sqrt((1-(w/w0).^2).^2+(w/(w0*q0)).^2));
x = atand(((w/(w0*q0)))/(1-(w/w0).^2));
plot(w,y)
grid on;
figure()
plot(w,x)
I am trying to plot second order frequency response for a particular form. I've tried using the bode and plot function to plot the phase and magnitude of a specific function for varying values of Q.
Nothing appears for the plot(w,x) I am expecting a 0 - 180 degree phase shift once w reaches 100.
Where am I going wrong? The first plot(w,y) functions as expected.
0 个评论
采纳的回答
dpb
2017-4-16
>> whos w
Name Size Bytes Class Attributes
w 1x51 408 double
>> whos x
Name Size Bytes Class Attributes
x 1x1 8 double
>>
OK, why dat???
x = atand(((w/(w0*q0)))/(1-(w/w0).^2));
Aha! "/" is matrix divide or mrdivide internally.
>> help mrdivide
/ Slash or right matrix divide.
A/B is the matrix division of B into A, which is roughly the
same as A*INV(B) , except it is computed in a different way.
...
What you're looking for here is element-wise division; these are the "dot" operators in Matlab--
Use
>> x = atand(((w/(w0*q0)))./(1-(w/w0).^2)); % instead, note the "./"
>> whos x
Name Size Bytes Class Attributes
x 1x51 408 double
>>
Now you'll see what you're expecting...
BTW, everybody has got to learn this sooner of later... :)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!