Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write it in MatLab: 1. The Lunar Phase Calculator. In this problem, you will construct a script that returns the lunar phase for a user-

Write it in MatLab:

imageimage

1. The Lunar Phase Calculator. In this problem, you will construct a script that returns the lunar phase for a user- specified date. We can quickly estimate the lunar phase by knowing two things: (i) the number of days between the user-input date and a known new-moon date (in this case, we will use the new moon that occurred on January 1, 1900) and (ii) the number of days in each lunar revolution. You program should: (a) Take 3 separate command window inputs for a given date in the following format: MMM DD YYY The month input must be capitalized. Ensure that your code requests the input in the order shown below and that the inputs are all taken as a string, which maximizes our opportunities for error checking (i.e.,input ('...', 's')). Please enter the month as MMM (e.g. DEC): Please enter the day as DD (e.g. 21): Please enter the year as YYYY (e.g. 2012): (b) Check the validity of the input and return an error if necessary. If the user inputs a non-numeric value or does not follow the formatting specification (e.g. YYYY as 19a6 or DD as 7 vs. 07) or inputs a date that does not exist (e.g. 1 MAY 32 2000, FEB 29 2019, or SEP .5 -354), return an error message to the command window and end the function. Design your program to work for year values from 1900 to 9999. Be sure to take leap years into account when performing your checks.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a MATLAB script that follows the requirements laid out in the problem statement matlab function lunarphasecalculator Take 3 separate command win... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Integrated Accounting

Authors: Dale A. Klooster, Warren Allen, Glenn Owen

8th edition

1285462726, 1285462721, 978-1285462721

More Books

Students also viewed these Programming questions

Question

Write a MATLAB program tointegrate /2 cos(cos.x) dr

Answered: 1 week ago

Question

Describe the process for correcting a general journal entry.

Answered: 1 week ago

Question

What information is contained on the Cash Payments Journal report?

Answered: 1 week ago