Asked by Pravallika
on 25 Jan 2013

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.

*No products are associated with this question.*

Answer by Matt J
on 25 Jan 2013

What happens when you do

ylim([0.3 30])

Pravallika
on 25 Jan 2013

The Y-axis limit changes from 0-30 and the graph completely changes. Not the way I want it.

Log in to comment.

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 1 Comment

## Jan Simon (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/59906-changing-x-and-y-axis-limits#comment_125574

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.

Log in to comment.