필터 지우기
필터 지우기

Why does my fplot output a plot filled with colored horizontal lines?

조회 수: 1 (최근 30일)
I am trying to run an fplot command and the resulting plot does not give me my expected output. The fplot is full of horizontal colored lines that I have no idea how to eliminate or to troubleshoot.
See attached screenshot.
omega_b=1800;
X=-4/(1800^2);
m=0.003;
k=10720;
c=0.01;
omega_n=sqrt(k/m);
zeta=c/(2*m*omega_n);
r=omega_b/omega_n;
theta_1=atan((2*zeta*omega_n*omega_b)/(omega_n^2-omega_b^2));
theta_2=atan(omega_n/(2*zeta*omega_b));
y=omega_n*X*((omega_n^2+(2*zeta*omega_b)^2)/((omega_n^2-omega_b^2)^2+(2*zeta*omega_n*omega_b)^2))^0.5*cos(omega_b*t-theta_1-theta_2)
fplot(y,[0 6*pi()])

채택된 답변

Walter Roberson
Walter Roberson 2019년 11월 12일
Your t is numeric, a 1 x 593 vector. Your y is then a 1 x 593 vector, with no symbolic variables. fplot() is then plotting those 593 different constant values over a range of x (which has no effect because the values are constant.)
  댓글 수: 2
Shane Palmer
Shane Palmer 2019년 11월 12일
Hello Walter,
Thank you for your quick response, I am not understanding how to properly define my function to plot then. I want to plot a function of t, but I dont want to define values of t until I use the "fplot" command. What would be the best method to do this?
Thanks alot!
Walter Roberson
Walter Roberson 2019년 11월 12일
If you have the symbolic toolbox,
syms t
instead of defining t as a numeric vector.
If you do not have the symbolic toolbox, then define
t = linspace(0, 6*pi, 593);
and build up y, and then,
plot(t, y)

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by