Lab Work 1,2
Lab Work 1,2
Cms: 46492
QNO1:
Find
Solve:
For increment we use colon sign in matlab to jump upto desire values ofour need syntex will
be X=-3:3
QNO2:
Solve:
X=-9:3:12
AS:
QNO3:
Solve
AS:
QNO4:
Solve:
Use the vector in Question 3, Use sign function to determine which of elements in vector x
are positive.
Solve:
By using sign fuction we can determined positive and negative numbers.If Matlab gives 0
number it means it is negative number if it gives 1 means it is positive number.
Lab No 2
QNO1:
2}Change back the format short or format long after you’ve completed this question.
Solve:
To change format from any number to rational number we write {rat()}to change it.
By writing format short or format long we change rational number to floating number upto 4
or 16 dight.
QNO2:
(i) Convert the angle from degrees to radians, and then use the cos function
(ii) (ii) Use the cosd function.
Solve:
When we use trignometry function without d it means to write radian in it.if we use d as cosd
mean angle can be used to find trignometry value.
QNO3:
Plots bar chart for x and y, three dimensional bar chart for y and pie chart for x on the same
figure windows (use subplot)
QNO4:
Let the vector G=[68,83,61,70,75,82,57,5,76,85,62,71,96,78,76,68,72,75,83, 93] Represent
the distribution of final grades in MATLAB for Engineering course.
(a) Use MATLAB to sort the data and create a bar graph of the scores
Solve:
The histc function can be used to determine the number of A’s, B’s,C’s,D’s and E’s in the
grade data, if the following grading schemes applies A> 90 to 100, B> 80 to 90, C> 70 to 80,
D> 60 to 70 E> 0 to 60 Use the bar function to create histogram based on this scheme.
1
Combine graphs of grads and E variable: