Hi Guys!(adsbygoogle = window.adsbygoogle || []).push({});

I am trying to plot two different graphs in the same window using MATLAB. I have some constants that I declare, I then plot the graph from 0 to 15 seconds. Then I change two constants and plot another graph from 15 to 30. The units along the x axis is Time (seconds) and velocity along (m/s) along the y axis.

The first graph seem to come out right, but the second is not. Don't know what is wrong. I believe I have written the function correctly.

This is my script :

clear all;

m = 200;

k = 100;

v0 = 0;

u = 200;

t = linspace(0,15,1500);

v = exp((-k/m)*t)*(v0-(u/k))+u/k;

figure(3);clf(3);

plot (t,v);

grid on;

hold on;

u = 0;

v0 = 2;

t = linspace(15,30,1500);

v = exp((-k/m)*t)*(v0-(u/k))+u/k;

plot(t,v);

ylabel('');

ylim([0 3]);

xlim([0 30]);

xlabel('');

title ('');

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Problems with a script in MATLAB

Loading...

Similar Threads for Problems script MATLAB |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Does anyone had this plotting problem with MATLAB? |

Mathematica Solve Perturbation problem with mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**