Question

Give the command that would be typed in MATLAB to define a variable X as the...

Give the command that would be typed in MATLAB to define a variable X as the sine of 30 degrees. Use proper syntax.

Give the command that would calculate the inverse tangent of (y/x) and give degrees. Use proper syntax.

Explain when the period (.) is needed before a * or / or ^ when writing code in MATLAB. Be specific and give an example.

Explain what a MATLAB function is, what components are required, and why they are useful.

Write out by hand a MATLAB function, USING PROPER SYNTAX, that will calculate the volume of a box, given the length, width, and height as input arguments.

Homework Answers

Answer #1

1.
Use command: X = sind(30)

2.
Use the command:  atand(y/x)

3.
'.' is needed when we want to perform element-wise operations in matrices or arrays.
For example, if we wan to multiply 3 to each element of a given matrix A.

Suppose A = [1 2 3; 4 5 6; 7 8 9],

Then we just write 3.*A,
this will give a matrix whose every element is multiplied by 3.

4.

A Matlab function can be seen as a set of commands or line of codes which are written together to perform some specific task.
Functions can take input arguments and they may or may not return something.

Functions are separate from the other codes.
In Matlab, we have to create separate .m files for writing the functions.

5.

disp(volumeOfBox(5, 5, 5)); % function call

function vol = volumeOfBox(l, b, h) % function definition

vol = l*b*h; % calculate the volume and store in vol

end

FOR HELP PLEASE COMMENT.
THANK YOU,

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Recall that the command diff(f(x),x) symbolically finds the derivative of the function f. Recall also that...
Recall that the command diff(f(x),x) symbolically finds the derivative of the function f. Recall also that the derivative is itself a function which can also be differentiated, giving us the second derivative of f, and so on. MATLAB will easily compute higher order derivatives using the command diff(f(x),x,n) Where n represents which derivative you want. Later, it will be very useful to find patterns in higher order derivatives. Ordinarily, this is most easily done by NOT simplifying the resulting expression,...
Write a Matlab program to plot the cosine wave. That is plot y=cos(k1x) vs. x for...
Write a Matlab program to plot the cosine wave. That is plot y=cos(k1x) vs. x for x varying from 0 to 2pi radians. The value of k1 is given at the end of this document. You can choose the increment for x. Note that large values of the increment will give you a coarse graph. Note: Matlab has two functions to calculate the sine of an angle: sin(x) and sind(x). What is the difference between these two functions? Use help...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following commands do: dd, y3, p, :set cindent (1 pt) VIM exercises These exercises on the computer need to be repeated by each student in the pair. This is to ensure that both students understand how to get around in Linux!!! For this part of the lab, you will create a .vimrc file that will help you develop your C++ programs using VIM. First, we...
3.   Consider the following data set for an office structure built by Anderson Construction Co. The...
3.   Consider the following data set for an office structure built by Anderson Construction Co. The completed building is nine stories. However, construction was interrupted by a fire after 5.3357 floors were completed. At the time of the fire, Anderson had used 54,067 hours of labor to construct the first 5.3357 stories of the building. It then took Anderson an additional 40,750 labor hours to complete this nine-story building. In this problem, FLRCOM is the number of floors completed, and...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may be given a list of raw email addresses and be asked to generate meaningful information from such a list. This project involves parsing such a list and generating names and summary information from that list. The script, eparser.py, should: Open the file specified as the first argument to the script (see below) Read the file one line at a time (i.e., for line in...
True or false? A larger sample size produces a longer confidence interval for μ. False. As...
True or false? A larger sample size produces a longer confidence interval for μ. False. As the sample size increases, the maximal error decreases, resulting in a shorter confidence interval.True. As the sample size increases, the maximal error decreases, resulting in a longer confidence interval.    True. As the sample size increases, the maximal error increases, resulting in a longer confidence interval.False. As the sample size increases, the maximal error increases, resulting in a shorter confidence interval. True or false? If the...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
1.) You will work with 0.10 M acetic acid and 17 M acetic acid in this...
1.) You will work with 0.10 M acetic acid and 17 M acetic acid in this experiment. What is the relationship between concentration and ionization? Explain the reason for this relationship 2.) Explain hydrolysis, i.e, what types of molecules undergo hydrolysis (be specific) and show equations for reactions of acid, base, and salt hydrolysis not used as examples in the introduction to this experiment 3.) In Part C: Hydrolysis of Salts, you will calibrate the pH probe prior to testing...
BridgeRock is a major manufacturer of tires in the U.S.. The company had five manufacturing facilities...
BridgeRock is a major manufacturer of tires in the U.S.. The company had five manufacturing facilities where tires were made and another 20 facilities for various components and materials used in tires. Each manufacturing facility produced 10,000 tires every hour. Quality had always been emphasized at BridgeRock, but lately quality was a bigger issue because of recent fatal accidents involving tires made by other manufacturers due to tread separation. All tire manufacturers were under pressure to ensure problems did not...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT