help with this question
2 ビュー (過去 30 日間)
古いコメントを表示
The magnitude of the force, in Newtons (N), of a spring with a spring constant k stretched a distance x, is given by F = k x, while the elastic energy stored in the spring, in Joules (J), is given by U = k x2 / 2. Write a program that requests the user to enter the value of k and the minimum, xmin , and maximum, xmax , value of x and then prints the force and potential energy, every ( xmax - xmin ) / 100. Make sure that the units are also printed.
4 件のコメント
回答 (1 件)
Image Analyst
2012 年 12 月 12 日
Try inputdlg() - there are examples in the help. For the rest, MATLAB is remarkably like C so you should have no problems.
1 件のコメント
Sean de Wolski
2012 年 12 月 12 日
Or you could just write it in C within the MEX header constructs and call that :)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!