Trying to plot a frequency response (magnitude and angle) using the equation of a forced vibration
조회 수: 9 (최근 30일)
이전 댓글 표시
I am meant to take the equation
x(t) = 0.016499i*w*exp(1).^(i*w*t); where w=3, t goes from 0 to 1 with increments of 0.01
and find the magnitude and the angle. My graphs are outputing this and i dont know why. Please help.
clear; clc; clf;
t= 0:0.1:1;
w=3;
xt = 0.016499*i*w*exp(1).^(i*w*t);
M = abs(xt);
Ph = angle(xt);
Ph2 = atan2(imag(xt),real(xt));
subplot(2,1,1)
plot(t,M)
subplot(2,1,2)
plot(t,Ph)
댓글 수: 0
답변 (2개)
Paul
2022년 2월 26일
According to the problem statement, the time increment should be 0.01
t = 0:0.01:1;
Other than that, the Matlab code implements the equation as written. Note that exp(1).^(..) can be replace with just exp(...)
t= 0:0.01:1;
w=3;
xt = 0.016499*1i*w*exp(i*w*t); % typical way to compute e^(iwt)
M = abs(xt);
Ph = angle(xt);
subplot(2,1,1)
plot(t,M)
subplot(2,1,2)
plot(t,Ph)
댓글 수: 0
David Goodmanson
2022년 2월 26일
편집: David Goodmanson
2022년 2월 26일
Hi Bryanna,
The problem statement asks for delta_t of .01, but you have .1 instead. Changing to .01 makes things clearer.
The expresson exp(1).^(i*w*t) is technically correct, but it's preferred to use the shorter version, exp(i*w*t)
The magnitude is indeed a constant, since all the factors of xt are constant when t is varied.
After going to delta_t = .01, it's fairly clear that the phase increases up to 2*pi and then takes an immediate jump down to -2*pi. That's because the output of atan2 is -pi< theta <= pi. The same is true of the angle function, so Ph and Ph2 are identical.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!