Question: Using MATLAB 1. Draw a square . Write a function (square) that takes two inputs (a string, and an integer) and draws a square with

Using MATLAB

1. Draw a square. Write a function (square) that takes two inputs (a string, and an integer) and draws a square with the specified integer side length using the specified string.

Example 1.

 >> square('.',6) ...... ...... ...... 
 ...... ...... ...... 

Example 2.

 >> square('8',15) 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 888888888888888 

Example 3.

 >> square('982',10) 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 982982982982982982982982982982 

ENGR 111 Lesson 23 MATLAB 3 Homework

2. Compute leap years. Write a function (leapyears) that takes two integer arguments (start year and end year) and prints a list of the leap years that occur between them (inclusive of the start and end year). Leap years are divisible by 4. Except that years divisible by 100 are not leap years unless they are also divisible by 400.

Example 1.

 >> leapyears(2004,2016) 2004 2008 2012 

2016

Example 2.

 >> leapyears(1881,1907) 1884 1888 1892 

1896 1904

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!