problem with polyfin with matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
mohamed gryaa
le 12 Sep 2019
Modifié(e) : Matt J
le 18 Sep 2019
Loudness=[2.79;3.16;3.71;2.29;2.49;2.64;2.9;2.79;2.91;3.35];
FlucStr=[0.0256;0.0277;0.0311;0.0246;0.021;0.0199;0.0194;0.0256;0.0213;0.0208];
Roughness=[0.491;0.6;0.728;0.34;0.425;0.515;0.617;0.491;0.389;0.438];
Sharpness=[1.03;1.11;1.21;0.887;0.934;0.954;0.985;1.03;1.04;1.12];
Leq=[39.7;40.9;42.6;38.1;38.9;39.5;40.6;39.7;40.3;41.7];
SIL=[29.4;30.9;32.9;26.9;28;28.8;30.1;29.4;28.8;30];
Tonality=[0.133;0.128;0.113;0.153;0.14;0.131;0.118;0.133;0.203;0.18];
Kurtosis=[2.2;2.2;2.2;2.44;2.49;2.48;2.45;2.2;2.39;2.38];
subjective=[7.5;7.02;6.94;7.91;7.96;7.91;7.78;7.42;7.86;7.47];
metriche=[Loudness FlucStr Roughness Sharpness Leq SIL Tonality Kurtosis];
i need to calculate polyfin for every 2 possible vector column with nchoosek in a loop for; i try this:
pairList = nchoosek(1:8,2);
pl=pairList';
for ii = 1:size(pl,2)
p=polyfitn(metriche(:,pl(:,ii)),subjective,1);
R(ii)=p.R2;
coeff(:,ii)=p.Coefficients;
end
the R and coeff are ok , but p is not ok.
where i am wrong??
0 commentaires
Réponse acceptée
Prabhan Purwar
le 18 Sep 2019
I am assuming that you are attempting to fit a polynomial for 2 vectors only, at a time.
In the present code polynomial is fitted to a 3-dimensional data set, giving rise to a surface plot.
Following code may help you:
pairList = nchoosek(1:8,2);
pl=pairList';
for ii = 1:size(pl,2)
M=metriche(:,pl(:,ii));
x=M(:,1);
y=M(:,2);
p=polyfitn(x,y,1);
polyn2sympoly(p)
R(ii)=p.R2;
coeff(:,ii)=p.Coefficients;
end
Hope this helps
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Fit Postprocessing 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!