I can't plot a function I created with respect for time
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I created this function "x(t)" with the given variables. Now I want to plot this function "x(t)" with respect to time and its not letting me.
%% Givens
m=2; %kg
k=200; %N/m
x0=0.05; %meters
x_dot=2; %m/s
%% Solution Part A
Wn= (k/m)^0.5;
c= (4*m*k)^0.5;
Cc= (2*m*Wn);
Zeta= c/Cc
%% Solution Part B
X= (((x0^2)*(Wn^2)+(x_dot^2)+(2*x0*x_dot*Zeta*Wn))^0.5)/(((1-(Zeta^2))^0.5)*Wn);
phi= atan((x_dot+(Zeta*Wn*x0))/(x0*Wn*((1-(Zeta^2))^0.5)));
Wd= ((1-(Zeta^2))^0.5)*Wn;
x(t)= X*(exp(-Zeta*Wn*t))* cos((Wd*t)-phi)
Please help
0 Kommentare
Antworten (1)
Star Strider
am 22 Feb. 2020
Specifically:
x = @(t) X.*(exp(-Zeta.*Wn.*t)).* cos((Wd.*t)-phi)
Also, use element-wise operations just to be safe, unless you want to do matrix operations. See Array vs. Matrix Operations for those details.
Unfortunately, when I tried to plot it, it was Inf everywhere. You need to solve that problem. Note that ‘X’ is Inf as well, so that is likely the reason. .
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!