Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
plot time

Subject: plot time

From: maria

Date: 30 Apr, 2009 07:05:19

Message: 1 of 2

Dear all,

I want plot the data getting from my program versus the spend time.
But the time is not a variable. I try to use the tic toc but I don’t
get the desired result. I don’t want to use something like t=[1:1:100]
because it doesn’t the same time every time to calculate the new
solution. Any idea?
 My program has the following mode:

a=5;
b=3;
sol=[];
s=1;

for i=1:5
   [s]=test(a,b,s);

sol=[sol;s];
end

plot(sol)

------------------------------------------
fun [s]=test(a,b,s)

syms x;

charfun=3*x^2 + 4*b*x + a*x^5 +s;
cal=solve(charfun);
s=max(cal);

Thanks for your time

Subject: plot time

From: Daniel Armyr

Date: 30 Apr, 2009 08:45:03

Message: 2 of 2

> I want plot the data getting from my program versus the spend time.

Hi. I am sorry, but this sentence isn't very clear to me. Do you want to plot the result of a function versus the time it took to find that solution? If so, your test should begin with a tic and end with a 'a = toc;'. The function should then return this value as well as the result so you can put it in a separate vector. Then you plot them against each other.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us