MATLAB Answers

Looking to plot yaw motion of an aircraft but get "Array indices must be positive integers or logical values." Error

10 views (last 30 days)
David Scidmore
David Scidmore on 29 Jan 2021
Commented: VBBV on 29 Jan 2021
clear all
clc
N_phidot = -0.36752;
N_phi = -8.3569;
N_delta_r = -3.8313;
delta_R = -10;
sigma = 1/2.*N_phi;
omega_d = (-N_phi-1/4.*(-N_phidot)^2)^(1/2);
xi = 1/2.*(-N_phidot/-N_phi^(1/2));
omega_n = (-N_phi)^(1/2);
beta = (N_delta_r/N_phi).*delta_R;
phi = atan(sigma/omega_d);
alpha = -1/2.*beta.*(omega_n/omega_d);
Tau = 2*3.14/omega_d;
xiomega_n = 1/Tau;
t = [0:0.01:10];
Phi(t) = beta.*(1-(omega_n/omega_d.*exp(-sigma.*t).*cos((omega_d.*t)-phi)));
Phidot(t) = diff(Phi(t));
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')
Error Messages
Array indices must be positive integers or logical values.
Error in HW1MAE503Q2 (line 22)
Phi(t) = beta.*(1-(omega_n/omega_d.*exp(-sigma.*t).*cos((omega_d.*t)-phi)));
>>

Answers (1)

VBBV
VBBV on 29 Jan 2021
%true
Phi = beta.*(1-(omega_n/omega_d.*exp(-sigma.*t).*cos((omega_d.*t)-phi)))

Tags

Community Treasure Hunt

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

Start Hunting!