Matrix is close to singular or badly scaled. Results may be inaccurate.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
arian hoseini
le 24 Juin 2022
Réponse apportée : Walter Roberson
le 24 Juin 2022
Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.986089e-23.
for k=1:40
a(k,1)=1;
a(k,2)=sin(W0*t(k));
a(k,3)=cos(W0*t(k));
a(k,4)=sin(3*W0*t(k));
a(k,5)=cos(3*W0*t(k));
a(k,6)=t(k);
a(k,7)=(t(k).^2);
b1(k,1)=V(k,1);
b2(k,1)=I(k,1);
end
a2=a';
a3=inv(a2*a);%warning come from this line itried a2\a but its not working and different here
a4=a3*a2;
Xv=a4*b1;
Xi=a4*b2;
thetav=atan(Xv(3,1)/Xv(2,1));
tv=rad2deg(thetav);
thetai=atan(Xi(3,1)/Xi(2,1));
ti=rad2deg(thetai);
z=((Xv(2)+(i*Xv(3)))/((Xi(2)+(i*Xi(3)))));
thetaz=atan(Xv(3,1)/Xv(2,1))-atan(Xi(3,1)/Xi(2,1));
tz=rad2deg(thetaz);
Z=abs(z);
3 commentaires
Walter Roberson
le 24 Juin 2022
We will need your W0 and t values to test with.
Note that a2\a is entirely different than inv(a2*a) . a2\a is closer to inv(a2)*a
arian hoseini
le 24 Juin 2022
Modifié(e) : Walter Roberson
le 24 Juin 2022
Réponse acceptée
Walter Roberson
le 24 Juin 2022
You have enough duplicate t values that when you calculate "a" the rank does not reach 7; rank of a2*a does not reach 7, so your 7 x 7 matrix is singular.
format long g
t=[0;0.0000;0.0001;0.0001;0.0001;0.0002;0.0003;0.0003;0.0004;0.0004;0.0004;0.0005;0.0006;0.0006;0.0006;0.0007;
0.0008;0.0008;0.0008;0.0009;0.0010;0.0010;0.0010;0.0011;0.0012;0.0012;0.0013;0.0013;0.0014;0.0014;0.0014
;0.0015;0.0015;0.0016;0.0017;0.0017;0.0018;0.0018;0.0019;0.0019];
W0=2*60*sym(pi);
t = sym(t);
a = zeros(40, 7, 'sym');
for k=1:40
a(k,1)=1;
a(k,2)=sin(W0*t(k));
a(k,3)=cos(W0*t(k));
a(k,4)=sin(3*W0*t(k));
a(k,5)=cos(3*W0*t(k));
a(k,6)=t(k);
a(k,7)=(t(k).^2);
end
a2=a';
temp = a2*a;
vpa(temp,4)
size(temp)
rank(temp)
size(a)
rank(a)
vpa(a, 4)
a3 = inv(double(temp))
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!