Answer All Questions
Q1:
On the answer sheet, write the results of the following instructions.
1\ >> a=[2.1 3.7 0;-4.3 1.9 -7.7;-9.2 8.1 3.2]; 9\ >> ans
2\ >> b=[0.2 -3.4 6.7 -5.6]; 10\ >> c(3)=[2 3]
3\ >> a=(:,1:2:3) 11\ >> m=tril(a)+round(a)
4\ >> floor(a) 12\ >> m>b
5\ >> ans(2)=[2 ] 13\ >> linspace(0,12,7)
6\ >> sum(triu(a')) 14\ >> disp('Happy day')
7\ >>c=[-2 0 1;3 2 1;0 1 6]; 15\ >> ans(3)
8\ >> f=a+ceil(a);
Q2:
1. On m.file write a MATLAB program to receive a set of numbers greater
than 20. Then the program shows the sum and the average of the numbers
that are divisible by 7 among the numbers that are entered.
2. On m.file write a MATLAB program to Calculates the sum of 50 terms of
the following series.
1 − 2 + 3 −.. .
4*7 6*9 8*11
Q3:
Write a MATLAB program on an m.file to calculate the current through the
resistor 300 for the circuit shown below:
Page 1 of 2
Q4:
Write a MATLAB program on an m.file to show a table with four columns as
follows:
The first column contains the angles from 0o to 360o in increments of 5o.
The second column contains the sine of the angles in the first column.
The third column contains the cosines of these angles.
The last column contains the sum of the first and second columns.
Page 2 of 2