필터 지우기
필터 지우기

Not sure how to use the disp function and num2str function from this point. Can someone help me out here?

조회 수: 19 (최근 30일)
The Richter scale is a measure of the intensity of an earthquake. The energy E(in gigajoules) released by an earthquake is related to the magnitude M on the Richter scale as follows.
E=(10^(-4.6))*(10^(1.5*M))
program the formula for E in a script file.
Use the input function to prompt the use to enter a value of M. The prompt should say "Please enter a Value M on the Richter scale, then press enter". use the disp function and the num2str function to display the numerical value of the energy E with the text "The energy released is:", followed by the value of E, followed by the text "Gigajoules."
So far I have
M=input('Please Enter a Value of M on the Richter scale, then press enter')
E=(10^(-4.6))*(10^(1.5*M))
How do I do this problem from this point?

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 4일
Hint:
[ 'Pi r^', num2str(3) ]

추가 답변 (1개)

Image Analyst
Image Analyst 2013년 3월 4일
You look up disp() and num2str() in the help, though personally I think fprintf() is a much better way to display things in the command window.
  댓글 수: 2
Brian
Brian 2013년 3월 4일
I've done that, I'm just not sure how to use them in order to achieve my desired result.
Image Analyst
Image Analyst 2013년 3월 4일
But we can't just give you the answer to your homework outright. The help should have examples you can adapt.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by