Help creating a function file

조회 수: 2 (최근 30일)
Steven
Steven 2012년 3월 17일
답변: Steve Miller 2022년 12월 21일
For this problem I need to create a function file that computes distance x and use my function to plot x versus W.
Here is the problem:
Figure P20 shows a mass-spring model of the type used to design packaging systems and vehicle suspensions, for example. ('of course I am aware you cannot see this figure').The springs exert a force that is proportional to their compression, and the proportionality constant is the spring constant 'k'. The two side springs provide additional resistance if the weight 'W' is gently placed, it moves through a distance 'x' before coming to rest. From statics, the weight force must balance the spring forces at this new position. Thus
W=(k1)*x [ if x < d ]
W=(k1)*x + 2(k2)*(x-d) [ if x >= d ]
These relations can be used to generate the plot of x versus W.
a) Create a function file that computes the distance x, using the input parameters W, k1, k2, and d. Test your function for the following two cases, using the values k1 = 10^4 N/m; k2 = 1.5 x 10^4 N/m; d = 0.1 m.
b) Use your function to plot x versus W for 0 <= W <= 3000 N for the values of k1,k2,and d given in part a.
PLEASE HELP!
Thank you..
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 3월 17일
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Joseph Areeda
Joseph Areeda 2012년 3월 17일
Steven,
It sounds a lot like you're asking us to do your homework for you.
Please read Walter's link. He's answered a lot of questions on these pages for us so I'm sure he's trying to help.
If your question is how to write a Matlab function see http://www.mathworks.com/help/techdoc/ref/function.html
If your question is how to plot the results see: http://www.mathworks.com/help/techdoc/ref/plot.html
In general, I've had good luck googling Matlab <what programming tool I want to use>.
If your question is will I do your homework for you, the answer is no.

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

답변 (1개)

Steve Miller
Steve Miller 2022년 12월 21일

카테고리

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