필터 지우기
필터 지우기

Plotting a function and it's derivative with multiple points of time

조회 수: 2 (최근 30일)
David Scidmore
David Scidmore 2021년 1월 28일
댓글: David Scidmore 2021년 1월 28일
I am working on trying to plot the perturbation roll angle from steady state and have the following.
clear all
clc
L_phi = -2.729;
L_sigma_a = -43.692;
sigma_a = -3;
beta = L_sigma_a./L_phi*sigma_a;
lambda = -L_phi;
tau = 1/L_phi;
t = 0:0.01:5;
phidot = beta*(1-exp(lambda*t));
phiddot = 2.279*phidot*phidot- 43.692*sigma_a*phidot;
figure(1)
plot(t,phidot)
title('phidot vs time')
xlabel('time in seconds')
ylabel('perturbation roll angle in degrees')
The error message(s) I get is
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of
rows in the second matrix. To perform elementwise multiplication, use '.*'.
Error in HW1MAE503 (line 21)
phiddot = 2.279*phidot*phidot- 43.692*sigma_a*phidot;
I have tried to use .* it just returns the same error message. Considering I'm multiplying each aspect of T by the same singuar value this doesn't make sense to me.
I believe that the Error in line 21 is because it has no value to access.
So my focus here is on the 501 time points and how to record that so I can plot.
If you could also tell me how to add units to the axis that'd be cool, but not needed as I'm okay with the label.
  댓글 수: 1
Matt J
Matt J 2021년 1월 28일
I have tried to use .* it just returns the same error message.
Not for me.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 28일
편집: Walter Roberson 2021년 1월 28일
L_phi = -2.729;
L_sigma_a = -43.692;
sigma_a = -3;
beta = L_sigma_a./L_phi*sigma_a;
lambda = -L_phi;
tau = 1/L_phi;
t = 0:0.01:5;
phidot = beta*(1-exp(lambda*t));
phiddot = 2.279.*phidot.*phidot- 43.692.*sigma_a.*phidot;
figure(1)
plot(t, phidot)
title('phidot vs time')
xlabel('time in seconds')
ylabel('perturbation roll angle in degrees')
plot(t, phiddot)
title('phiddot vs time');
syms t
phidot_s = beta*(1-exp(lambda*t));
phiddot_s = diff(phidot_s, t)
phiddot_s = 
fplot(phiddot_s, [0 5]);
title('phiddot vs time, symbolic computation')
This suggests that your formula for phiddot is incorrect. You have exp(t) kind of function, and the derivative of that is not going to be t^2 - t kind of function.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by