plotting with respect to time

8 visualizzazioni (ultimi 30 giorni)
Areg Arzoomanian il 23 Feb 2020
Risposto: madhan ravi il 23 Feb 2020
%% 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= (2*m*Wn);
Cc= (2*m*Wn);
Zeta= c/Cc
%% Solution Part B
for t=0:10
C1=x0;
C2=x_dot+Wn*x0;
x = @(t) (C1+C2*t)*exp(-Wn*t)
end
I want my function to plot with respect to time. The ezplot generated begins the x-axis at -5.5, however since this is a plot of response with respect to time, -5.5 does not exist. Long story short, how can I make my plot go from a certain time range of 0s to 10s. Thank you
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Risposta accettata

madhan ravi il 23 Feb 2020
C1=x0;
C2=x_dot+Wn*x0;
x = @(t) (C1+C2*t)*exp(-Wn*t)
fplot(x,[0,10])
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by