For each of the problems in this lab assignment, write a separate MATLAB file. T
ID: 2083490 • Letter: F
Question
For each of the problems in this lab assignment, write a separate MATLAB file. The name of each file must be exactly as specified in the corresponding problem statement. Submit your files by uploading to Blackboard before the due date. Filename: MAE 1090_Lab 12_1. m MAE1090_Lab12_1.xlsx Write an m-file to generate a excel spreadsheet containing the sine, cosine, and tangent of theta for theta between 0 and 90 degree, in 1 degree increments. The program should properly label each of the columns in the table. Here is what the first few lines of your spreadsheet should look like:Explanation / Answer
% MAE1090_Lab12_1.m
clc;
clear all;
filename = 'MAE1090_Lab12_1.xlsx';
theta = 0:1:90;
a = sind(theta); % obtains sin of argument in degrees
b = cosd(theta); % obtains cos of argument in degrees
c = tand(theta); % obtains tan of argument in degrees
label = {'theta','sin(theta)','cos(theta)','tan(theta)'};
xlswrite(filename,label)
xlswrite(filename,theta','A2:A92');
xlswrite(filename,a','B2:B92'); % a' means a transpose. We have used transpose bcoz
xlswrite(filename,b','C2:C92'); % transpose interchanges row and columns.
xlswrite(filename,c','D2:D92');
---------------------------------------------------------------------------------
Note: In MATLAB, the inbuilt functions such as sin,cos and tan consider their arguments as radians (by default). So if you calculate sin(30) in matlab. You will get sin(30) = -0.9880. (as MATLAB considers 30 in radians.)
If you need to perform operations on arguenments in degrees, you can use sind, cosd, and tand.
sind(30) will give you sind(30)=0.5000.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.