Hello all,
The plot opens up with all the appropriate labels, but the actual line does not show up. I have tried switching the 'w' and 'f' in the function H1 and H2 when I try to plot.
f = -100:0.1:100;
w = 2*pi*f;
H1 = @(s) (s.^2 + 98010.65) / (s.^2 + 52.36*s + 98010.65);
subplot(2,1,1)
plot(f,abs(H1(j*w)),'k')
grid on
%xlabel('2*pi*f')
%ylabel('|H_1(j*2*pi*f)|')
subplot(2,1,2)
plot(f, angle(H1(j*w)))
grid on
%xlabel('2*pi*f')
%ylabel('<H_1(j*2*pi*f)')

 채택된 답변

David Goodmanson
David Goodmanson 2019년 3월 12일
편집: David Goodmanson 2019년 3월 12일

1 개 추천

Hi Henry,
In the definition of H1, use
./ instead of /
so you get term-by-term division. To spot the error, one straighforward thing to do Is define a new variable
z = H1(j*w)
subplot(2,1,1)
plot(f,abs(z),'k')
This puts z into the workspace and allows you to see that it is a scalar, so it will not plot vs. f. That puts you on the hunt for a particular kind of error in H1.
In this situation I did not get there using the debugger. Maybe someone with more expertise than I have with using the debugger on anonymous functions will weigh in on how to do it.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2019년 3월 12일

편집:

2019년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by