Write a matlab program that prompt the user for an integer and print the integer digits

3 ビュー (過去 30 日間)
Helen97
Helen97 2015 年 4 月 16 日
回答済み: kayode logo 2017 年 12 月 5 日
Write a matlab program that prompt the user for an integer and print the integer digits
Input / Ouput example:
Enter number: 68575
The number is: 5*10^0 + 7*10^1 + 5*10^2 + 8*10^3 + 6*10^4
  1 件のコメント
pfb
pfb 2015 年 4 月 16 日
Is that your homework?
Leaving matlab syntax aside, do you have any clue as to the algorithm you are going to use?
Look into the builtin function "input". Type
doc input
in the command window to summon the documentation.

サインインしてコメントする。

回答 (1 件)

kayode logo
kayode logo 2017 年 12 月 5 日
: A mass on a spring in a vacuum chamber is displaced below its equilibrium point a distance yo equal to the last digit of your student number. The spring is displaced within its ‘elastic’ limit so that the response of the spring is ‘linear’ and Hooke’s Law is obeyed. The mass is let go and it undergoes simple harmonic motion, oscillating about the equilibrium point with angular frequency  (radians/sec) equal to the second last digit of your student number. At time = 10 s, the vacuum is lost and air enters the chamber. The air causes friction that exponentially damps the motion of the mass on the spring with k = 0.1 /s, as shown below in the equation. Write a MATLAB script file to plot the displacement of the mass as a function of time, from t = -2 s to t = 20 s. o o o cos(ω )
0
10 cos(ω )exp( ( 10))
) 1 0 ( 0 t t y t y t y y t k t t             Your code should make use of a “for” loop, and “if” statements. In an appendix of your report, include your code, and the plot created by the program. The plot should have the axes labelled and a title that includes your name and student number, i.e., your name and number must appear in the title of the plot. Plots can be copied to Word by going to ‘Edit’ on the figure window ribbon at the top, then ‘Copy Figure’, and finally paste into Word

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by