Trying to plot a function of time while a variable changes values at different time intervals

2 visualizzazioni (ultimi 30 giorni)
As the title states I'm trying to plot a function (or two actually), while a variable changes at different variables. The program just continues to run and doesn't actually stop so it's stuck somewhere and I can't figure out where. Also would this work once it's able to complete? I don't like having the beta inside the loop, but get an error whiles outside.
clear all
clc
L_phi = -2.729;
L_sigma_a = -43.692;
lambda = L_phi;
tau = 1/L_phi;
t = [0:0.01:5];
for t <= 5
if t < 2.5
sigma_a = -3;
elseif t >=2.5
sigma_a = 0;
for beta = (L_sigma_a/L_phi).*sigma_a;
phidot = beta.*(1-exp(lambda.*t));
phi = beta.*(t-1/tau.*exp(tau.*t));
end
end
end
figure(1)
plot(t,phidot)
title('phidot vs time')
xlabel('seconds')
ylabel('degrees')
figure(2)
plot(t, phi)
title('phi vs time')
xlabel('seconds')
ylabel('degrees')
Unrecognized function or variable 'phidot'.
Error in HW1MAE503 (line 23)
plot(t,phidot)

Risposte (0)

Categorie

Scopri di più su Polar Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by