In: Computer Science
1. Given a vector, a, of length n, write down the MATLAB expressions that will correctly compute the following:
a. ln (3 + a + a2 )
b. ea (1 + cos(3a))
c. cos2 (a) + sin2 (a)
d. tan-1 (a)
Test that your solution works for a = 1:0.2:2
2. a. Create a vector of odd whole numbers between 10 and 40.
b. Create a vector of even whole numbers between 25 and 35.
3. Plot a Straight line with slope m=0.5 c=-2 at the following coordinates X=0, 4,5,7,9,10,12,15.
4. Plot y=sin x, 0<=x<=4pi, taking 50,100 linearly spaced points in the given interval.
a=1:.2:2;
%1)
a1 = log(3 + a + a.^2)
b1 = exp(a).*(1 + cos(3*a))
c1 = cos(a).^2 + sin(a).^2
d1=atan(a)
%2
a2 = 11:2:40
b2=26:2:35
%3
X=[0, 4,5,7,9,10,12,15];
Y = .5*X - 2;
plot(X,Y)
%4
x=linspace(0,4*pi,50);
y=sin(x);
plot(x,y)
%5
x=linspace(0,4*pi,100);
y=sin(x);
plot(x,y)