Info

This question is closed. Reopen it to edit or answer.

Can someone help me out with this code, it doesn't seem to be giving the correct output. I have MATLAB 2017a and this code ran on MATLAB 2013a

1 view (last 30 days)
clc
clear all
close all
syms n a x y z
a=input('Please enter the matrix:');
bb=a-n*eye(size(a,1));
cc=det(bb);
gg=solve(cc);
%Eigenvectors
b=[a-n*eye(size(a))]*[x;y];
for i=1:2
d=subs(b,n,gg(i));
end
c=solve(d);
e=[c.x c.y];
disp(c);
g=subs(e,z,1);
disp(e);
disp(g);

Answers (1)

Elizabeth Reese
Elizabeth Reese on 18 Aug 2017
I think that there are two changes that you are seeing to the Symbolic Math Toolbox here.
The first is that the order of elements in gg changed between the versions. Is there a different way that you can assign d to avoid this inconsistency?
The second change is that a Name-Value pair was introduced between R2013a and R2017a called ReturnConditions. You can add this to a call to solve to parameterize the solution. This was done in R2013a without the flag which is why that outputs are functions of z. If you set this flag to true in R2017a, then you can achieve the same parameterization. When you use this Name-Value pair, the result stored in c will include a field called parameters and another called conditions. You can use the parameters to do the substitution later on when you assign g.

Community Treasure Hunt

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

Start Hunting!