تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
Question 3. User input, using matrix indices to extract or add data, fprintf.
You will design a short interactive program that allows the user to ask questions about one of
four planets.
A) Below you will see a table with information about four planets in our solar system. Enter
only the numerical data into MATLAB in a 3x4 matrix called PlanetData or a similar variable of
your choice.
Earth
Jupiter
Mars
Venus
# of Moons
1
7.9
2
0
gravity in m/s
Length of day
in hours
9.8
23.1
3.7
8.9
24
9.9
24.7
2082
B) Create a menu which allows the user to select which planet they would like to know
information about.
C) Depending on which planet the user selects, use a MATLAB command to extract the data in
that column and store it in a variable called Select Data or something similar.
D) Use a fprintf statement to output onto the screen a sentence that says, "The planet you have
chosen has X moon(s), a gravitational acceleration of X m/s and X hours in the day." where "X"
is the actual number.
E) You have just heard on the news that Pluto IS a planet!!! Celebrate by using a MATLAB
command (or commands) to add a fifth column to PlanetData containing the following
information about Pluto:
moons 5, gravity 0.7m/s, and length of day-153.3 hours.
This can be done in one line but it's okay if you do it in more.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.