Question: Write a MATLAB function that takes an odd integer n and draws an hourglass pattern with ( n + 1 ) / 2 rows at

Write a MATLAB function that takes an odd integer n and draws an hourglass pattern with (n+1)/2 rows
at the top and bottom with n stars and squeezing in middle rows. For n =5, the pattern should look like
this:
*****
*****
*****
***
*
***
*****
*****
*****
Hint: Use nested loops to handle spaces and asterisks.

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!