SECTION 19CoMPUTING wITH MATLAB 146 Determine the numeric va
     SECTION 1.9-CoMPUTING wITH MATLAB 1.46 Determine the numeric value of x in each of the following MATLAB instructions: (a) t pi/3; x cos(t) (b) t 1:4; x 32 sin (t)  
  
  Solution
MATLAB CODE :-
clear
 clc
 i =1;
 disp(\'x = cos(t)\ \')
 t = pi/3
 x1 = cosd((t*180)/pi)% a) t = pi/3 ; x = cos(t)
 sprintf(\'t = pi/3 \\t \\t x = cos(t) = %f\',x1);
%%
for t = 1:1:4 % b) t = 1:4; x = 2* sin(t)
 t1(i) = t;
 x2 = 2*sind((180*t)/pi);
 x(i) = x2;
 i = i+1;
 end
 disp(\'x = 2*sin(t)\')
 t1
 x
 sprintf(\'t = %d\ \',t1);
 sprintf(\'x = %f\ \',x);
OUTPUT : -
x = cos(t)\
t =
1.0472
 x1 =
0.5000
x = 2*sin(t)
t1 =
1 2 3 4
 x =
1.6829 1.8186 0.2822 -1.5136

