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

Printing - matrices, Printing - matrices: For matrices, the MATLAB unw...

Printing - matrices: For matrices, the MATLAB unwinds the matrix column by column. For illustration, consider the random 2 × 3 matrix as shown below: >> mat = randint(2,3,[

Recognizing people in video based on their body", I am doing project "Recog...

I am doing project "Recognizing people in video based on their body" the system will use MATLAB to detect people based on thier body and then recognize them from their clothes "us

Excel, Ask question Excel Ch 1.A-Grader Project-Training Workshops 1.5#Mini...

Ask question Excel Ch 1.A-Grader Project-Training Workshops 1.5#Minimum 100 words accepted#

Notion of permutation, what are the difference between a.linear permutati...

what are the difference between a.linear permutation b.circular permutation

Adaptive filters, Adaptive filters can also be used in other applications. ...

Adaptive filters can also be used in other applications. Speech recognition, for example, is performed in a non-stationary environment, and therefore may require adaptive filtering

Program to find the minimum total cost for the fence, A fence enclosure con...

A fence enclosure consists of a rectangle of length L and width 2 R , and a semicircle of radius R , as shown in Figure 1. The enclosure is to be built to have an area of 1600 m

Create a new vector - vector manipulation, Write single MATLAB statements t...

Write single MATLAB statements to create these vectors from any vector Z. You can use vector Z shown as a sample input. Create a single m-file script (non-function) to containing a

First order differential equations, First order differential equations: Eul...

First order differential equations: Euler's method Finally, we consider ?nding the numerical solution for a ?rst order differential equation given an initial value. We consider

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