Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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 回表示 (過去 30 日間)
ShantanuR
ShantanuR 2017 年 8 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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);

回答 (1 件)

Elizabeth Reese
Elizabeth Reese 2017 年 8 月 18 日
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!

Translated by