Introduction to vectors, scripts, and functions, MATLAB Programming

Assignment Help:

In this lab, we study the three concepts. Vector is used to store more than one value into single variable. It is similar to array (other programming language). Script is a collection of statement which is stored into single file name. Function is used to solve the equation and return the result value. It has parameters also.

Sample of Vector:

» x=[-2:5]

x =    -2    -1     0     1     2     3     4     5

Sample of Script:

Impact_v1.m contains,

M=input('Enter the value of m, Mass of the Airplane : ');

V=input('Enter the value of v, Velocity of the Airplane : ');

D=input('Enter the value of Displacement, Displacement of the Airplane : ');

F=(0.5*M*V^2)/D;

disp('The value of the force is printed below : ');

F

How to run the Script?

            » run impact_v1

Sample functions:

function f = ImpactForce(m,v,d)

f = 0.5*m*v^2/d ;

We have learned how to work with vectors and plots. As a result of this lab we computed the impact force for initial velocities from 10m/s to 50m/s as shown in Figure 1. The computations are performed in the ImpactForceVec.m function and the script to set up the calculation is called Impact_v3.m.

297_Introduction to Vectors, Scripts, and Functions.png

Figure 1: The figure shows the impact force on the building for initial speeds ranging from 10m/s to 50m/s. The mass of the aircraft is taken to be 10,000kg, and a stopping distance of 15m is used.


Related Discussions:- Introduction to vectors, scripts, and functions

Suspension, how to control a suspension by linear quadratic regulator metho...

how to control a suspension by linear quadratic regulator method?

Illustrations of calling the rand function, Illustrations of calling the ra...

Illustrations of calling the rand function: The function ‘rand’ can be used to produce random real numbers; calling it produces one random real number in the range from 0 to

Illustration of input function, Illustration of Input function: For il...

Illustration of Input function: For illustration, >> rad = input('Enter the radius: ') Enter the radius: 5 rad = 5 If character or string input is preferred, 's' s

Estimate the sample mean and sample standard deviation, The fuel consumptio...

The fuel consumption of a certain make of car may not be exactly that rated by the manufacturer. Suppose ten cars of the same model were tested for combined city and highway fuel c

Rungakuta methord, the basic equation of modeling radioactive decay is wher...

the basic equation of modeling radioactive decay is where the amount of the radioactive substance is at time and is the decay rate. Some radioactive substances decay into other rad

Matlab programming vector algebra, Matlab Programming Vector Algebra : Crea...

Matlab Programming Vector Algebra : Create a program package for calculation of distances and intersections of lines and planes. Plot the results in a graphical representation

Metlab, cAN Can I learn Metlab .I am X Scientist in DigitalCommunication. C...

cAN Can I learn Metlab .I am X Scientist in DigitalCommunication. Can U please help me.I know the programming concepts

Adjacency matrix, how to create adjacency matrix for amino acids in matlab?...

how to create adjacency matrix for amino acids in matlab?

Create matlab graphs of data properly annotated, A. Introduction The p...

A. Introduction The project consists of two parts. In the first part you are asked to perform some preliminary calculation and plotting, and to write the introduction for your

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd