Trying to plot a frequency response (magnitude and angle) using the equation of a forced vibration

9 Ansichten (letzte 30 Tage)
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)

Antworten (2)

Paul
Paul am 26 Feb. 2022
According to the problem statement, the time increment should be 0.01
t = 0:0.01:1;
t = 1×101
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800 0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700 0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600 0.2700 0.2800 0.2900
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)

David Goodmanson
David Goodmanson am 26 Feb. 2022
Bearbeitet: David Goodmanson am 26 Feb. 2022
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.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by