Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Report Questions: Plot Sin and Cos function plots from 0 radian to 2 radians with x axis labeled 'Radians' and Y axis labeled 'Sine

Lab Report Questions:
Plot Sin and Cos function plots from 0 radian to 2 radians with x axis labeled 'Radians' and Y axis labeled 'Sine and Cosine Functions' with:
a."pi0.01" linear spacing
(Hint: Use x=0:**0.2:2**)
(Hint: Use x=0:**0.01:2**)
DO NOT TAKE A SCREEN SHOT! USE 'SAVE FIGURES AS IMAGES' OPTION AS DEFINED ABOVE.
What are the minimum and maximum values of each trigonometric function?
Does the increment (linear spacing value) change the min and max values? Explain why?
What does linear spacing value change?
Write at least one error message you have seen during this lab.
Array Generation and Indexing:
array1=[0.00.52.1-3.56.00.0-1.1-6.62.83.42.10.10.3-0.41.31.15.10.01.1-2.0]
[Execute these questions in the command window]
a) Generate the array above. (Hint: Use arrayl =[0.00.52.1-3.56.0;0.0dotsdots???]
b) What is the size of array1?(Hint: Use size function in command window.)
c) What is the value of array 1(1,4)?
d) Evaluate the output of max (array1). Describe its function. (Hint: doc max and figure out how to use it and explain in one sentence.)
e) BONUS [DO IT YOURSELF]- Search online and find the solution yourself: How can we find the maximum of the complete array?
Array size: Determine the size and contents of the following arrays (Take a screenshot of each output). Note that the later arrays may depend on the definitions of arrays defined earlier in this exercise. Understand each output well, you will need it in the next lab and following topics.
[Execute these questions in the command window]
a)a=2:3:8; Initializing a variable with linear spacing of 3
b)b=[a'a'a']; %ranspose Example
c)c=zeros(1,3); Automatic initialization
d) Analyze the output of previous question(c). What does zeros function generate? Check 'doc zeros' to gain more information.
Page 4 of 6
Introduction to Programming - Lab Manual
Output Formatting:
Background
num2str: Converts number to string
int2str: Converts string to number
fprintf: Formats data and displays the results on the screen
[Execute these questions in the command window]
Assign 10 to variable value. value =10** pi
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions