Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a matlab: How many days are there until winter break? To answer this, write a matlab function that works for any day of 2017.

Write a matlab:

How many days are there until winter break?

To answer this, write a matlab function that works for any day of 2017. Count the days from today until winter break on Dec 12, and display the result. This breaks into 3 counts:

1) The days remaining in the current month

2) The days in the months between now and Dec (there are none now that it's Nov, but make this work for any month).

3) The days in Dec

Be careful though, this breaks down once you get to Dec, so use logic statements to deal with this.

Hints:

1) The matlab command

today = clock; 

creates a six element array with the current date and time stored across a single row:

today = [year, month, day, hour, minute, seconds] 

2) First solve the question assuming it is Nov. Then add code to account for other months. That way, you'll have the basic structure down and even if you can't figure out the rest, you will get credit.

3) Start with the following Matlab code:

.

function winterbreak breakmon = 12; breakday = 10; % The number of days in each calendar month (ignore leap year) monthdays = [31 28 31 30 31 30 31 31 30 31 30 31]; % Use clock to get the current year month and day % use logic to check if we are in breakmon (December) already % add up the days for each of the 3 cases described above % disp the result end 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions