Changing X and Y axis limits??

CODE:
function x = logmap(R, timesteps, xinit, color)
clc
x = zeros(timesteps,1);
x(1) = xinit;
for t = 1:length(x)-1
x(t+1) = R*x(t)*(1-x(t));
end
plot(x, [color,'.-'])
xlabel('time')
ylabel('population')
and query the code with
logmap(3.25,50,0.3,'b')
I get a figure with values 0-50 on the X-axis and 0-1 on the Y-axis. But what I am trying to do is init value of 0.3 on the scale of 100 (i.e) the Y-axis scale should be 0-100 such that the init plot is 0.3 * 100 = 30.
I tried to change the limits using 'Plot tools' which basically changed the whole graph. And also I have tried using 'axis' which does not seem to work here.
I tried both the approaches like I mentioned in my question. Not sure they work the way I want them to. The problem is with mapping init value of 0.3 with Y-axis value 30 on X-axis timestep 1. Thanks.

1 commentaire

Jan
Jan le 28 Jan 2013
I do not understand "init value of 0.3 on the scale of 100 (i.e) the Y-axis scale should be 0-100 such that the init plot is 0.3 * 100 = 30." Please explain this again.

Connectez-vous pour commenter.

Réponses (1)

Matt J
Matt J le 25 Jan 2013

0 votes

What happens when you do
ylim([0.3 30])

1 commentaire

Pravallika
Pravallika le 25 Jan 2013
The Y-axis limit changes from 0-30 and the graph completely changes. Not the way I want it.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by