Attach all your work including the Matlab code in a word fil

Attach all your work including the Matlab code in a word file and submit it to your Blackboard. In Matlab, sin, cos, sin d, cos d are trigonometric operations. Specifically, - sin(x) and cos(x) find the sine and cosine of x when x is expressed in radians; e.g. sin(pi/6) = 0.5. - sin d(x) and cos d(x) find the sine and cosine of x when x is expressed in degrees; e.g. cos d(60) = 0.5. Please calculate the following Math expressions in Matlab: (a) sin theta for theta = 3 pi. (b) sin pi. Is your running result zero or not? (c) Find the cosine of 45 degrees. You may convert the angle from degree to radians and then use the cos command, or directly use cos d command. (d) cos alpha for 0 lessthanorequalto alpha lessthanorequalto 2 pi; let alpha change in steps of 0.2 pi.

Solution

clc;
clear all;
close all;

%(a)
theta=3*pi; % Here theta in radians so we have to use sin or cos not sind or cosd
a=sin(theta);
fprintf(\'\ \\t (a) sin(3*pi)= %0.4f \ \',a);

%(b)
theta=pi;
b=sin(theta);
fprintf(\'\ \\t (b) sin(pi)= %0.4f \ \',b);
% So sin(pi) equal to zero because it is radians.

%(c)
theta=45;
c=cosd(theta); % Here theta in degrees so cosd is used.
fprintf(\'\ \\t (c) cos(45)= %0.4f \ \',c);

%(d)
theta=0:.2*pi:2*pi;
d=cos(theta)

 Attach all your work including the Matlab code in a word file and submit it to your Blackboard. In Matlab, sin, cos, sin d, cos d are trigonometric operations.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site