0% found this document useful (0 votes)
77 views

MATLAB - Programming Excercise - 1 - and - 2

This MATLAB programming exercise document outlines 12 programming tasks. The tasks include: 1) generating random integers and counting evens/odds, 2) finding powers of 2 below 1000, 3) summing consecutive positive elements in a vector using break, 4) summing all positive elements in a vector using continue, 5) calculating factorials recursively, 6) defining a function to calculate the area and circumference of a circle, 7) generating an HTML file to plot a spiral equation, 8) generating an HTML file to plot sin and cos polar plots, 9) plotting one cycle of sin(t) and labeling a point, 10) allowing a user to input text and click to place it on a plot, 11) allowing a user to choose

Uploaded by

pyp_pyp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

MATLAB - Programming Excercise - 1 - and - 2

This MATLAB programming exercise document outlines 12 programming tasks. The tasks include: 1) generating random integers and counting evens/odds, 2) finding powers of 2 below 1000, 3) summing consecutive positive elements in a vector using break, 4) summing all positive elements in a vector using continue, 5) calculating factorials recursively, 6) defining a function to calculate the area and circumference of a circle, 7) generating an HTML file to plot a spiral equation, 8) generating an HTML file to plot sin and cos polar plots, 9) plotting one cycle of sin(t) and labeling a point, 10) allowing a user to input text and click to place it on a plot, 11) allowing a user to choose

Uploaded by

pyp_pyp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

MATLAB Programming Exercise 1

1. Randomly generate seven integer numbers and count even and odd numbers among these
numbers and display this count.
2. Using while loop, find powers of 2 below 1000 and display each of them.
3. Enter a vector of positive and negative integers and sum first consecutive positive
numbers of this vector only and display this sum. (hint:Use break)
4. Enter a vector of positive and negative integers and sum all positive numbers of this
vector only and display this sum. (hint:Use continue)
5. Find factorial of inputted number n using recursion.
6. Using user defined function find the area and circumference of the circle whose radius is
inputted from the keyboard.

MATLAB Programming Exercise 2


7. Using publish menu of MATLAB, generate a html file to show spiral plot for following
−θ
equation: r ( θ )=e 10 0 ≤ θ≤ 10 π

8. Using publish menu of MATLAB, generate a html file to show Polar plots of sin, cos.

9. Plot one cycle of sin(t) and put a text box and arrow to show sin(t)=.707 value on plot.

10. Take a text input from keyboard and put it on empty plot wherever the user clicks on this
empty plot. (hint: Use ginput() )

11. Input radius of circle using keboard and show menu where user can choose to draw these
plots: Cartesian, polar, stem

12. Write a Matlab script file to generate a Fahrenheit-Celsius temperature table for the
temperature in the range of -40 to 100 degree Fahrenheit in the step
of 5. Store the table in a file named 'Temperature.txt'.

You might also like