How do I plot datas from the variable matrix.
Show older comments
Hello,
I am trying to solve below problem;

"Using MATLAB, investigate the nature of the variation of the principal values and directions over the interval 1 < x1 < 2. Formally plot the variation of the absolute value of each principal value over the range 1 < x1 < 2."
And here is what I've done so far:
clc;
clear all;
x=[1:0.1:2];
for i=1:length(x)
A(i,:,:)=[2*i,i,0;i,-6*(i^2),0;0,0,5*i]
% Calculate Invariants
invariants(i)=[trace(A),(trace(A)^2-trace(A*A))/2,det(A)]
[V,L]=eig(A(i))
% Principal Values are the Diagonal Elements of the L Matix
principal_values(i)=abs([L(1,1),L(2,2),L(3,3)])
% Principal Directions are the Columns of the V Matrix
principal_directions(i)=[V(:,1),V(:,2),V(:,3)]
end
I was able to handle the calculation part. But I could not able to plot that.
I need to plot each data in "principal values" vector in the range of 1 < x <2.
The result will be like this:

Thank you in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!