Solving and Plotting Initial Value Response using EXPM() function
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Star Strider
2017-10-2
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!