Alexandria University
Faculty of Engineering
Mechanical Dept.
ME242
Sheet 2: Graphics
1. Plot y versus x, if 0<x<10 & y=x2 make the axis square, label the axes, and
show the grids.
2. Plot the functions y1=sin(4x), y2=cos(x), y3 = (x+1)-1
for x=1:
Alexandria University
Faculty of Engineering
Mechanical Dept.
ME242
Sheet 1: Basics
Section I: Arithmetic Functions:
1. Calculate for x = 10 & y = 3
a. u = x +y
b. v = xy
c. w = x/y
2. Save the variables x and y in a file named problem and then cl
Alexandria University
Faculty of Engineering
Mechanical Dept.
Matlab
Solution Sheet 2: Graphics
1. Take care of the dot before ^,*, /
clear;clc;clf
x=0:10;
y=x.^2;
plot(x,y)
xlabel('X');ylabel('Y')
grid on
axis('square')
2. Use hold on to plot all
Alexandria University
Faculty of Engineering
Mechanical Dept.
Matlab
Sheet 3: Programming
1. Write a program that accepts a numerical value x from 0 to 100 as input
and computes and displays the corresponding letter grade given by the
following ta
Express Solution Sheet 3: Programming
1. Problem (1-i) use nested if
clear;clc
x=input('Please enter your mark:')
if x>100 | x<0
disp('Error: Mark not in range')
else if x>=90
disp('Your Grade is: A')
else if x>=80 & x<90
disp('Your Grade is: B')
else if