Creating a dynamical plot with a for loop
Ältere Kommentare anzeigen
Imagine we quickly create a matrix with some values in it, called 'number':
matrix1=rand(10);
m=0.5;
number=zeros(size(matrix1));
for i=2:9
for j=2:9
number1(i,j)=(matrix1(i,j+1).*m);
number2(i,j)=(matrix1(i+1,j).*m);
number(i,j)=sqrt((number1(i,j))^2+(number2(i,j))^2);
end
end
imagesc(number)
You can see that the value of number(i,j) is dependent on m. Now i want to make a plot where m values vary in function of the day of the year.
mnew=zeros(365,1);
for s=1:365
mnew(s)=m*s;
end
I now got number(i,j) with the values that should be dependent on m, and a file with the temporal evolution of m throughout the year. How can i now create a dynamic graph that will show the evolution of number(i,j) throughtout the year (as a function of varying m)?
Thanks in advance!
2 Kommentare
Image Analyst
am 3 Dez. 2015
So you have 8 i and 8 j - so that's 64 values for "numbers", but 365 m values. So which 64 m values do you want to use out of the 365 available to you?
yoni verhaegen
am 3 Dez. 2015
Bearbeitet: yoni verhaegen
am 3 Dez. 2015
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!