Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to store values to the matrix and retrieve later as shown below ?

1 次查看(过去 30 天)
I want to store values on L to J correspondently and make a plot later using J or L(If values can store in L instead J)
p(:,1) = [0;0];
r(:,1) = [0;0];
L(:,1) = [0];
J(:,1) = [0];
syms r1 r2
for n=1:0.1:x;
p =[0 (1/3)^n;(1/2)^n 0];
[V,D]=eig(p);
L= [V(2,1)/V(1,1)]
J(1,n)=L
end

回答(1 个)

KSSV
KSSV 2019-3-27
YOu can further reduce the variables:
m = 10 ;
L = zeros(m,1) ;
J = zeros(m,1) ;
x = 1:0.1:m ;
for i = 1:length(x)
n = x(i) ;
p =[0 (1/3)^n;(1/2)^n 0];
[V,D]=eig(p);
L(i) = [V(2,1)/V(1,1)] ;
end

此问题已关闭。

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by