Solving and Plotting Initial Value Response using EXPM() function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I make matrix dimensions work when trying to solve and plot Initial Value Response to State Space model and using expm() function?
Code:
clear all
close all
clc
syms t
time = [0:0.01:10]
A = [0 1 ; -5 -2]
B = [0;1]
x_naut = [1;-1]
[eig_vector, eig_value] = eig(A)
v_inv = inv(eig_vector)
eAt = expm(A.*time)
x = expm(A).*x_naut
fplot(time,x)
0 commentaires
Réponses (1)
Star Strider
le 2 Oct 2017
Try this:
time = [0:0.01:10];
A = [0 1 ; -5 -2];
B = [0;1];
x_naut = [1;-1];
for k1 = 1:numel(time)
eAt = expm(A.*time(k1));
x(:,k1) = [1 0; 0 1]*eAt*x_naut;
end
figure(1)
plot(time,x)
grid
0 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!