discrepancy of symbolic calculations for MATLAB 2010a and MATLAB 2012a
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I obtained two different results while running the following code using MATLAB 2010a and MATLAB 2012a respectively. Using MATLAB 2010a, I obtained 0 for delta1_sub as the result. Using MATLAB 2012a, I obtained that delta1_sub equals the following:
(60*w*sin((5*w)/2) - 20*cos((5*w)/2) - sin((5*w)/2)*20*i - w*cos((5*w)/2)*60*i - w*84*i - 32*w^2 + w^3*12*i - 32)
Any idea of what is happening would be greatly appreciated.
clc;clear all;
syms s alpha1 alpha2;
syms z1 z2 w real;
cos1=(1-z1^2)/(1+z1^2);
cos2=(1-z2^2)/(1+z2^2);
sin1=2*z1/(1+z1^2);
sin2=2*z2/(1+z2^2);
e1=cos1-sin1*1i;
e2=cos2-sin2*1i;
A=[0 1;
-8 -3];
B1=[0 0;
-1 -3];
B2=[0 0;
-8 1];
B3=[0 0;
-5 0];
n=size(A,1);
tau3=2.5;
ce=numden(simplify(det(s*eye(n)-A-B1*e1-B2*e2-B3*(cos(tau3*w)-1i*sin(tau3*w)))));
cez=collect(subs(ce,s,w*1i),w);
CEre=collect(real(cez),z2);
CEim=collect(imag(cez),z2);
CEre_alpha2=subs(CEre,z2,alpha2);
CEim_alpha2=subs(CEim,z2,alpha2);
delta1=collect(factor(CEre*CEim_alpha2-CEim*CEre_alpha2)/(z2-alpha2),alpha2)
delta1_sub=vpa(subs(delta1,z1,1i))
2 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!