Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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 commentaire
pfb
pfb le 16 Avr 2015
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.

Connectez-vous pour commenter.

Réponses (1)

kayode logo
kayode logo le 5 Déc 2017
: 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

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by