polyfitn, problem have coefficent and r2 alone

3 views (last 30 days)
i have a problem with this exercise please can you help me
i have this matrix1;
metriche= 2.7900 3.1600 3.7100 2.2900 2.4900 2.6400 2.9000 2.7900 2.9100 3.3500 (1 row Loudness)
0.0256 0.0277 0.0311 0.0246 0.0210 0.0199 0.0194 0.0256 0.0213 0.0208 (2 row fluc.str)
0.4910 0.6000 0.7280 0.3400 0.4250 0.5150 0.6170 0.4910 0.3890 0.4380 (3 row roughness)
1.0300 1.1100 1.2100 0.8870 0.9340 0.9540 0.9850 1.0300 1.0400 1.1200 (4 row sharpness)
39.7000 40.9000 42.6000 38.1000 38.9000 39.5000 40.6000 39.7000 40.3000 41.7000 (5 row leq)
29.4000 30.9000 32.9000 26.9000 28.0000 28.8000 30.1000 29.4000 28.8000 30.0000 (6 row sil)
0.1330 0.1280 0.1130 0.1530 0.1400 0.1310 0.1180 0.1330 0.2030 0.1800 (7 row tonality)
2.2000 2.2000 2.2000 2.4400 2.4900 2.4800 2.4500 2.2000 2.3900 2.3800 (8 row kurtosis)
and i have this matrix2
subjective= [7.5000 7.0200 6.9400 7.9100 7.9600 7.9100 7.7800 7.4200 7.8600 7.4700]
i try to obtain the polyfitn, the coefficents,And,R2 but the program say this:
pkurtosissil=polyfitn(metriche([8;6],:)', subjective',1);
coef([8;6],:)=pkurtosissil.Coefficients;
r([8;6])=pkurtosissil.R2;
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
  2 Comments
dpb
dpb on 6 Sep 2019
I can't find any such function as polyfitn in current ML documentation...
Nishant Gupta
Nishant Gupta on 9 Sep 2019
Hi dpb,
Yes, you are right there is no function named polyfitn as such in MATLAB but there is a function named polyfitn , which you can find on file exchange using the following link:

Sign in to comment.

Accepted Answer

Nishant Gupta
Nishant Gupta on 9 Sep 2019
Hi Gryaa,
If you check the size of pkurtosissil.Coefficients in the workspace, it is [1 x 3] and you are trying to store it in
coef( [8;6] , : ) whose actual size is [2 x 10] . That is why you are gettting the error.
So, you can replace the second line of your code with the following one to get all your coefficients:
coef(1,:)=pkurtosissil.Coefficients;
Similarly, you can do with R2 also.

More Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!