Effacer les filtres
Effacer les filtres

For loop formula and graphing problems

2 vues (au cours des 30 derniers jours)
Todd
Todd le 9 Nov 2013
Commenté : Todd le 9 Nov 2013
So I'm trying to plot the code below, and when I run the m file it simply gives me a blank graph with a y axis that only goes from 99-100. In addition running the for-loop by itself gives me 100 replicates of the results.
What do I need to do to fix this?
A=[0 0 .42
.6 0 0
0 .75 .95];
B=[42
0
95];
for i = [1:100]
Nt(:,i) = (A^i)*B
end
plot(Nt(:,i),i)
title('American Buffalo Population')
ylabel('Time (years)')
xlabel('Population')
subplot(3,1,1);plot (Nt(1,:))
subplot(3,1,2);plot (Nt(2,:))
subplot(3,1,3);plot (Nt(3,:))
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 9 Nov 2013
What is your problem?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 9 Nov 2013
  1 commentaire
Todd
Todd le 9 Nov 2013
That worked, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by