I need Correct Subplot for This Code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi Everyone , I'm new to using MATLAB.
Please Help me , Thanks a lot.
This is my Homework Question :
The desired array is a subset of the number of data attributes (columns) in the CSV table file.
Note: In this exercise, two Nested FOR are used.
We want to have a subplot (for example 5 by 5) in which two attributes (columns) are displayed relative to each other.
The number of selected attributes is given as an array to the input function (for example as] [1 5 8 3] which means that we want to see the attributes mentioned in pairs in a 4 by 4 subplots.
Also for each case of Pairs of array elements plots we want to apply linear regression and then with the help of coefficients obtained from the function, polyfit draw a line graph on each plots.

This Picture is The Example Of Correct Output Subplots For Array : [1 5 8 3]
This is my code but i have some problem , Based on this code, the output is not same as this picture ,i need correct subplot code :
Arrayinput = input ('Enter Array: ');
CASP = csvread('CASP.csv');
alength = length (Arrayinput);
for i=Arrayinput
for j=Arrayinput
i1=CASP(:,i);
j1=CASP(:,j);
%subplot(alength,alength,i); this is my problem , what is corrcet
%subplot for this Nested For Loop and array
plot(j1,i1,'.');
if (i==j)
title([num2str(i),'->',num2str(j),'y=x',' ','MSE = ']);
end
if (i~=j)
title([num2str(i),'->',num2str(j),' ','MSE = ']);
end
end
end
0 Kommentare
Akzeptierte Antwort
Jan
am 2 Mai 2021
counter = 0;
for i=Arrayinput
for j=Arrayinput
...
counter = counter + 1;
subplot(alength, alength, counter);
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!