Plotting velocity of a piston

조회 수: 8 (최근 30일)
Mike
Mike 2012년 10월 4일
Hi everyone,
At the moment I'm trying to use MATLAB to plot velocity of a piston for an engineering report but I'm having trouble with my values. I have an equation for the velocity as a function of the angle of the crankshaft from vertical, and this is my code so far:
>> x=0:360; %0-360 deg rotation
>> b=asind(.0405*sin(x)/.13); the angle I need in my equatin, based on x
>> y=29.688*(sin(0+b))/(sin(90-b)); the equation of velocity of the piston
So for each value of x I have a value for b, but y only comes up with one value, rather than 361. I've been going through help files in MATLAB but to no avail. Can anyone guide me?
Thanks,
Mike

채택된 답변

Matt Fig
Matt Fig 2012년 10월 4일
편집: Matt Fig 2012년 10월 4일
You probably wanted element-by-element division rather than array division...
y=29.688*(sin(0+b))./(sin(90-b)); % Note ./ rather than /
  댓글 수: 1
Mike
Mike 2012년 10월 4일
Thanks heaps mate: I'm still new at using it, and that gets me everytime!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 10월 4일
sin() operates on radians, but you are feeding it degrees. sind() is the degree equivalent.
  댓글 수: 1
Mike
Mike 2012년 10월 4일
Thanks for clarifying that Walter, I saw sind in the help file and was wondering what it represented :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by