Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Matlab Program

  • Please log in to reply
1 reply to this topic

#1 Biggre


  • Members
  • 17 posts
  • Local time:11:18 AM

Posted 26 October 2006 - 01:50 PM

Im currently working on a program where a person is crossing m boards, which are n feet long and is p drunk where p is 0<p<1 I am having trouble figuring out how to work the animation code that the instructor has given us to work off of.

m_points=input('Enter the number of planks: ') 
n_points=input('Enter the number of steps the sailor must take to get to the end of the planks: ') 
%p=input('Enter how drunk you sailor is as a decimal between 0 and 1: ') 
%x = [1,1] 
%y = [0,1] 
hold on 
while a < m_points 
	y = [0,n_points]; 
	a = a + 1; 
	hold on 
plot(x, y), hold on; 
h1=plot(x, y, 'o', 'EraseMode', 'normal'); 
for  k = 1:length(n)	  
   set(h1, 'XData', x(k), 'YData', y(k)); 
   pause(1); % needs to be adjusted 
			   % depends on speed of computer 
hold off

Any help or suggestions would be appreciated.

BC AdBot (Login to Remove)


#2 Walkman


  • Banned
  • 1,327 posts
  • Gender:Male
  • Local time:11:18 AM

Posted 27 October 2006 - 03:46 PM

I've just done a search on the term Matlab Program, and it gave me a host of results, along with tutorials.

My Suggestions and (or) help below....

Do a search on it in a search engine and you should findenough results to get you going.

Also, I read your post and noticed that you said your instructor gave that to you to do (as an assingment, and I'm sure you'll be graded on it), and if it is indeed a school assingment, I personally feel that you're cheating and you're looking for an easy way out of learning how to figure this problem/assingment. I'm POSITIVE your answers are within the materials that you have. That's the purpose of studying.. so you can, and will learn whatever it is you're assigned to do.

I'm only saying this because you said an instructor (teacher) gave it to you to do.... so I'm assuming you're in school. If that's really the case.....


...and.. if it is a school assignment, what will you learn out of it if you want the answer given to you? You never mentioned that you tried to figure it out.

Don't take this personally, but I used to be a G.E.D. instructor.

One Man's Opinion

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users