I need Correct Subplot for This Code
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Jan
le 2 Mai 2021
counter = 0;
for i=Arrayinput
for j=Arrayinput
...
counter = counter + 1;
subplot(alength, alength, counter);
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!