Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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 vue (au cours des 30 derniers jours)
ShantanuR
ShantanuR le 16 Août 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
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);

Réponses (1)

Elizabeth Reese
Elizabeth Reese le 18 Août 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.

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by