You are Here: Home

Matlab help

Maths and statistics discussion, revision, exam and homework help.

Announcements Posted on
Important: please read these guidelines before posting about practical exams on The Student Room 26-11-2013
1. Matlab help
I have the following code which takes frames at intervals of 1000, is it possible to change it so it also always takes a frame at the final value of 'k'?

for j=1:1000:k

M((j-1)/1000+1) = getframe;

plot(x(1:(j+1)),y(1:(j+1)))

axis equal

if x(j+1)==H1 && y(j+1)==H2
break
end
end

hold off
movie(M)
Last edited by parpirate; 10-05-2012 at 13:50. Reason: Smilies grr
2. Matlab help
It's been a while since you posted and nobody's replied yet...maybe you should check out MarkedbyTeachers.com, TSR's sister site. It has the largest library of essays in the UK.

They've got over 181,000+ coursework, essays, homeworks etc.. all written by GCSE, A Level, University and IB students across all topics. You get access either by publishing some of your own work, or paying £4.99 for a month's access. Both ways give you unlimited access to all of the essays.

All their documents are submitted to Turnitin anti-plagiarism software, so it can't be misused, and the site's used by hundreds of thousands of UK teachers and students.

What's more, you can take a look around the site and preview the work absolutely free. Click here to find out more...
3. Re: Matlab help
(Original post by parpirate)
I have the following code which takes frames at intervals of 1000, is it possible to change it so it also always takes a frame at the final value of 'k'?

for j=1k

M((j-1)/1000+1) = getframe;

plot(x(1j+1)),y(1j+1)))

axis equal

if x(j+1)==H1 && y(j+1)==H2
break
end
end

hold off
movie(M)
so is it only taking frames up to (and including) the value of k-1?
I'm not entirely sure, but couldn't you change your first line to

for j=1k+1

I'm not sure if this would work, as now instead of missiing out the value of k, it will miss out the value of k+1.

I would try this, but i'm not completely secure with Matlab, so if it doesnt work then i cant help sorry if im just useless
4. Re: Matlab help
(Original post by elldeegee)
so is it only taking frames up to (and including) the value of k-1?
I'm not entirely sure, but couldn't you change your first line to

for j=1k+1

I'm not sure if this would work, as now instead of missiing out the value of k, it will miss out the value of k+1.

I would try this, but i'm not completely secure with Matlab, so if it doesnt work then i cant help sorry if im just useless
Thanks, the problem was that is k=12765 for example the last frame plotted would be 12001. It was plotting a journey from a pub to a house and would have been handy to have the last frame plotted. Coursework has been handed in now though...

Step 2: Register

Thanks for posting! You just need to create an account in order to submit the post
1. this can't be left blank

this is what you'll be called on TSR

2. this can't be left blank

never shared and never spammed

3. this can't be left blank

6 characters or longer with both numbers and letters is safer

4. this can't be left empty
your full birthday is required
1. By completing the slider below you agree to The Student Room's terms & conditions and site rules

2. Slide the button to the right to create your account

You don't slide that way? No problem.

Last updated: May 17, 2012
Study resources