Question

Using MATLAB. As an engineer working on designing and modelling a new drone product, you are...

Using MATLAB. As an engineer working on designing and modelling a new drone product, you are doing a lot of different physics calculations. Your boss wants to write a program that can choose from an assortment of calculations and perform the desired physics calculation in order to streamline the design and modelling process. For this project you will write a function called PhysicsCalc.

inputs

Your function should take three inputs in the following order:

var1–The first number in the calculation you want to perform.

var2–The second number in the calculation you want to perform

var3–The third number in the calculation you want to perform

indicator–A variable, that has a data type of your choice, that the user will use to determine which operation to perform. You should note in a comment how you are implementing the indicator variable.

Outputs

Your function should have one output, result. Your function should be able to perform the following operations and should assume SI units for each input:

-Distance Given var1 as a 1-dimensional acceleration, and var2 as 1-dimensional velocity, and var3 as time, determine result via the formula:

distance= velocity*time1/2acceleration*time^2

Work. Given var1 as a force, var2 as a distance an object moved, and var3 as the angle between the force and the direction of movement (in radians), determine result via the formula:\

work= force *distance*cos(angle)

Falling object velocity Given var1 as an initial speed and var2 as an amount of time, and var3 as the force of gravity acting upon the object, calculate the result via the formula:

velocity(final)=velocity(initial)+g*time

Torque. Given var1 as a force acting upon an object with a fixed axis of rotation, var2 as a distance away from the axis of rotation, and var3 as the angle of the force with respect to the parallel along which the distance was measured, calculate the result via the formula:

torque=force*distance*sin(angle)

Note that every time this function is called, it should only perform one of these calculations. However, the user should be able to choose from any of the calculations with each call using the indicator input.

If a user calls your function with an indicator value that is not associated with anything, please return a string with a message indicating this as your output instead of the result of a calculation. You can choose what that message is.

.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

code:
function return_value = netidPhysics(var1,var2,var3)

indicator = input('Enter 1 for Distance or 2 for Work or 3 for Falling Object Velocity, 4 for Torque: ');

switch indicator
  
case 1
a = var1;
v= var2;
t = var3;
distance = v*t*(1/2*a)*t^2;
  
return_value = distance;
case 2
f = var1;
d = var2;
angle = var3;
work = f*d*cos(angle);
  
return_value = work;
case 3
u = var1;
t = var2;
g = var3;
Vfinal = u+g*t;
  
return_value = Vfinal;
  
case 4
f = var1;
d = var2;
angle = var3;
Torque = f*d*sin(angle);
  
return_value = Torque;
otherwise
fprintf(' WRONG CHOICE OF INPUT, please choose from options 1 to 4 above')
return_value =[];
end
end

------------------------------------------

%MATLAB COMMAND

clc
clear

result = netidPhysics(4,1,5)

Add a comment
Know the answer?
Add Answer to:
Using MATLAB. As an engineer working on designing and modelling a new drone product, you are...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MAT LAB: write a program that can choose from an assortment of calculations and perform the...

    MAT LAB: write a program that can choose from an assortment of calculations and perform the desired physics calculation in order to streamline the design and modelling process. Your function should take three inputs in the following order: var1 – The first number in the calculation you want to perform. var2 – The second number in the calculation you want to perform var3 – The third number in the calculation you want to perform indicator . A variable, that has...

  • Using C programming Description: You have been tasked to design an application for an engineering...

    Using C programming Description: You have been tasked to design an application for an engineering firm to measure the performance of their vehicle designs. The user, an engineer will enter data into your program when prompted and will perform the required calculation and output the answer. The formula used for this project calculates the distance an object will cover in meters given an initial velocity, a rate of acceleration and a time of acceleration or travel. 1. Your program must...

  • Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been...

    Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been visited recently? The answer is not in the book. See https://developer.mozilla.org/en-US/docs/Web/API/History. Think about the situation where the alert message displays “your reply was false.” Describe the type of person who would generate that output—someone who always tells the truth, someone who always lies, or some other type of...

  • i want the code and the answer to last image question#4 please By the way, we...

    i want the code and the answer to last image question#4 please By the way, we need to print values for velocity, acclaration, mass, all of the values This program will prompt the user for the following input The distance an object traveled from point 1 to point 2 (variable distance) The time required to travel distance (variable time) The object's initial velocity (variable initVelocity) . The mass of the object (variable mass) You will need to write a series...

  • MATLAB You Cannot Use guide, You must create a GUI using code only Problem 1 (100...

    MATLAB You Cannot Use guide, You must create a GUI using code only Problem 1 (100 pts) This week you will repeat the second problem from Week 8 (the problem is restated below for your convenience) but you will add a GUI (without using guide) for the user to control the execution of the program. Your program should do the following: Create a figure that contains a plotting area and user interface controls Allow the user to input the initial...

  • Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an...

    Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an interactive program that performs fractional calculations. You need define a class CFrac for a fractional number according to the UML diagram below: CFrac - numerator : int - denominator : int - simplify () : void + CFrac (int = 0, int = 1) + ~CFrac() + add (const CFrac&) const : CFrac + subtract (const CFrac&) const : CFrac + multiply (const CFrac&)...

  • MATLAB Grader CONTENTS For this problem you will model a field goal attempt in an NFL football ga...

    MATLAB Grader CONTENTS For this problem you will model a field goal attempt in an NFL football game as a simple projectile motion problem. For a field goal attempt, the ball is snapped seven yards back from the line of scrimmage, where the place holder holds the ball on the ground for the kicker. For a successful attempt, the kicker must kick the ball through the uprights above the cross bar, which is ten feet high and parallel to the...

  • For this homework you will be creating functions in SciLab. You will turn in electronically, each of the functions requ...

    For this homework you will be creating functions in SciLab. You will turn in electronically, each of the functions requested below. Part Problem Statement: Create a function called Projectile that will give you the X and Y location of an object while in flight. The cquations for the X and Y locations are given below function [X, Y]= Projectile (Velocity, Angle, Gravity) Input variables: Velocity velocity in units of m/sec Angle angle of the launcher from 0 to 90 Degrees...

  • Before you start doing this code Read carefully there is a format that you have to...

    Before you start doing this code Read carefully there is a format that you have to follow HERE IS THE FORMAT YOU MUST USE FOR HW #2 - NOTE THE IF ELSE IF...not IF IF IF HW #2 Format : Instructions: This program will generate some information for a user about interplanetary travel (pretend we can travel easily to other planets for this problem). This program will perform calculations concerning weight on various planets as well as travel time between...

  • Please can someone help me to finish this program? It is a C programming not a...

    Please can someone help me to finish this program? It is a C programming not a C++, when programming the program in linux I keep getting expected expression before || token, also please check if everything else is fine, maybe there is something else worng in my program and may ask me later to fix it, I am concern about the sin and cosine. The program is supposed to do all this: 1.Display a welcome message. 2.Prompt for the height...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT