Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
26 views
11 pages
Asigniment 1 (Matlab)
this is the matlab code for the python solution
Uploaded by
Biniyam Teketel
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Asigniment 1 (matlab) (3) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
26 views
11 pages
Asigniment 1 (Matlab)
this is the matlab code for the python solution
Uploaded by
Biniyam Teketel
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Asigniment 1 (matlab) (3) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 11
Search
Fullscreen
Lab Session 1 Assignment 1 Problem: Write a Matlab program for the following problem: Use graphical method to determine the approximate mass of the bungee jumper to have a velocity of 40 m/s after 3sec of free fall taking a drag coefficient of 0.25 kg/m. ( The acceleration of gravity is 9.81 m/s*2. ) Title: Approximate Mass and Graphical Method Objective: obtaining the estimate of the root of the equation f(x)=0 by using a plot of the function and observe where it crosses the x-axis Tools: MATLAB Theo Newton's Second Law of Motion to calculate the range of possible masses (mp) for a bungee jumper (given a final velocity of v, time for free fall t, and drag coefficient cd) based on the differential equation for the free fall under drag. The example plots the difference in final velocity the bungee jumper might receive compared to the given final velocity, as a function of the Possible masses mp. To obtain the estimate of the root of the equation f(x)=0 by using a plot of the function and observing where it crosses the x-axis. © To obtain mass in terms of velocity (v), time of free fall (t), drag coefficient (cd), and acceleration of gravity (g) F(m)= Venvic * tanh((Vg.c/m)*t) — v(t} Procedure: 1.Define constants for the final velocity (v), time of free fall (t), drag coefficient (cd), and acceleration of gravity (g). 2.Create an array of possible masses (mp). 3.Create a function to calculate the difference between the final velocity and velocity that would be reached by a bungee jumper of a given mass (fp). 4,Plot a graph of the mass of the person (mp) against the difference in velocities (fp). 5.Find the mass of the person that produces no difference in velocities. This is the optimal mass.Trial (1) - estimated the value of mass to be between 50 and 200 kgs. MATLAB code: 5 8|o # aas|B 2 | > OB Nee open srw [cre SP ~ | acme eg Bo] min tinemcAoons | gee | leaner section 1) Run Ena ] SWS [Sr wos Br tne B| 2 ¥ = 0; % Final velocity in w/s BI) = siete Sa E| 5 = 9.1; X acceleration of gravity in m/s2 By S| ste» coy of pntba meee 2 | Srthscrece 3 x Function to calculate difference between finel velocity and velocity that would be rea fo = sartlermo/ed).*tanh(sart(ered./mp)"®) ~ vi WORKSPACE 2 plotenp.fp)-enid “115 12 125 13 435 14 4145, 50 700 150 200Trial(2) - estimated the value of mass to be between 50 and 200 kgs. MATLAB code: EOTOR fa LE VERSIONS E Fada? 2 gee ta |» oo Qma ~ 18 Run and Advance few Open sive | Goto eacor | Aun fun Step Se Se Rasen | Minened - BB o> marae pve ig |! Assoomenttm = + Bra |” x constants 3) 2 wo; % final velocity in 1/s | 3 2) % tine of Free fall in seconds al ¢ = 6.25; % drag coefficient in ke/e Bl 5 | g-9.81; x acceleration of gravity in m/s? 3) 6 E) 7 | create » range of possible masses Yl) 2 ap = Linspace (200,508); £| 9 ©) 20 G]_ x runction to coleuate difference between Final velocity B) ix Tx locity thot wld be reached by 9 bmgce jomper of given mss 22 f= Santetep/ed) *tann(sart(ared./m)"t) — vs 23 34 ploténp, fp) eri ‘Output: 10.9 1 44 “11.2 “11.3 “11.4 “11.5 “116 AN, 200. 250 «300 350 400 450 500Trial(3) - estimated the value of mass to be between S00 and 1000 kgs. MATLAB code: = es Fea. |B ass 2 acc.| & > ~ + ~ + BA Bookman + + = section tf) Run to Ene ~ ES [ao 1 > MATLAB Ove — “Assianmenttim = 1 % Constants 2 10} % Final velocity in m/= 3 5° tine of Free fall in seconds 4 ed = 0.25; % drag coefficient in ke/m 7 @ - 9.81; % acceleration of gravity in m/=*2 (CURRENT FOLDER % Create o range of possible masses nip = Linspace (509,1008) ; & Function to coleulate difference between final velocity and velocity that would be reached by 2 bungee jumper of a given mass 12 ¥o = sart (ermp/ed).*tanh(sart(etcd./mp)*t) = vz [woRKSPACE: fl u“ plot (ap, fp),ertd 10.75 10.8 10.85 10.9 10.95 -14 ‘500 ‘600 700 800 900 1000,Conclusion: From the graph obtained, we can see that the line doesn’t cross the x-axis, (root doesn't exist) in the given range of mass Therefore, we conclude that the velocity diverges for any value of mass given © Ifwe want to compute this analytically we figure out the same conclusion F(m)= Vgm/e * tanh((Vg.c/m)*t) — v()=0 By direct substitution we get, m= 40.832 kg By using the given time and different mass values, the following velocities are obtained m= 10 kg V= 17.87 mis 40 kg 25 mis 70 kg 26.6 mis 100 kg 27 mis 130 kg 27.86 mis 160 kg 28.14 mis 190 kg 29 mis From the analytic results, we can also observe that the velocity 40 m/s doesn't exist for any value of mass in the given instant of time.Exercise 1.1 Problem : Make a new folder to save your files 2. Open a new script 3. Write a code to draw graphs of the following functions and save it. - Generate x1 and x2 vectors each containing 100 and 1000 elements respectively using built in functions for automatic. initialization. (Use the “linspace” function which starts at 0, and ends at 4M) - y1 = cos x1 -y2= sin x2 4, Customize your plots to identify the two functions. Objective: The objective of this exercise is to practice creating and saving plots of the cosine and sine functions using the “linspace” function to generate x-values, and customizing the plots to distinguish the two functions. MATLAB code: eaoely, 2 gaa BS Dp |} Q fing + 1 Run ana Advance New Open Save | GoTo Refactor BB Run Run Step SP oomrate = |e OD isn ig) nine = FAB) a > arias drive Resgrmenim = > ° 1 xi = Linspace(®, 4%pi, 100); % Generate xi vector with 100 elements from 0 to pi @ 2 x2 = linspace(@, 4*7i, 1000); % Generate x2 vector with 1000 clenents from 0 to 4pi 3 Vi = cos(xi); % Calculate yi y2 = sin(x2); % Calculate y2 then custowizing the plot to ease the distinguishing ‘ by using the color code and to identify the functions in the graph using the “Legend” plot(xt, yi, “blue"); % Plot yi in blue hold on} plot(2, y2, ‘red'); % Plot y2 in red legend(y1 = cos(xl)", 'y2 = sin(x2)'); % Add legend to identify the tuo functions title("Plot of yi and y2"); % Add titleOutput: Plot of y1 and y2 Conclusion: The code creates two vectors, x1 and x2, with 100 and 1000 elements respectively, ranging from 0 to 4*pi. It then calculates y1 as the cosine of x1 and y2 as the sine of x2. The code then plots y1 in blue and y2 in red on the same graph using the ‘hold on’ command. A legend is added to identify the two functions, and a title is added to the graph. The overall result is a graph that shows the plotted y1 and y2 functions, and it's easier to distinguish the two functions by using different colors, and the legend and title make the graph more informative,Exercise 1.2 Proble: 1. Create two vectors “a” and “b” with 4 elements each. 2. Create a matrix “c” using the two row vectors. 3. Create another matrix “d” by replacing the last row of matrix “c" with a row vector having all elements of value “3”. 4, Exercise by applying simple elementary operations (element-wise and standard operations), on matrices you created, Title: Matrices and Arrays Objectives: Generating and entering Matrices and arrays and Applying Basic scalar operations. Tools: MATLAB. MATLAB code: $aalas Rex Gee anes |(com BBS > mason. CURRENT FeuDeR c= (es ons ; #5 Ces 3,3 3 ae woRKSSHCEcreate two vectors a and b 0=[,2,3,4) b=[5, 6,78] %Create a matrix ‘c* using the two row vectors c= [0:6 %Create another matrix “o" by replacing the last row of matrix “c" with a row vector having all elements of value *3" d= [ell 3, 3,3, 3} % Element-wise addition of matrices ¢ and d e=c+d: % Standard matrix multiplication of matrices ¢ and d feotd: % Element-wise division of matrix d by scalar 2 gr d/2, % Transpose of matrix ¢ h %print the values disp(d) disple) displf) displ) disp(h) 1015000 1'5000 15900 1/5000 eee Sm - aes 18) un ana avant & Toe cine «| BEES, ance le fe eeGeGloc ce rae . Bb) 3 3G Boiss? 5 Conclusion: The conclusion of this code is that it performed several operations on two vectors, including creating a matrix, element-wise addition and multiplication, division, and transposition. "
You might also like
LAB 1 - Lab 8 Numerical Analysis Lab
PDF
No ratings yet
LAB 1 - Lab 8 Numerical Analysis Lab
151 pages
Signals and Systems - Prof - Ishit Shah PDF
PDF
No ratings yet
Signals and Systems - Prof - Ishit Shah PDF
35 pages
Lab02 PDF
PDF
No ratings yet
Lab02 PDF
17 pages
Matlab Workbook: CME 102 Winter 2008-2009
PDF
No ratings yet
Matlab Workbook: CME 102 Winter 2008-2009
55 pages
2 Array and Matrix Operations PDF
PDF
No ratings yet
2 Array and Matrix Operations PDF
39 pages
Cme100 Matlab Workbook
PDF
No ratings yet
Cme100 Matlab Workbook
31 pages
An Introduction To Ordinary Differential Equations M Files: Atlab
PDF
No ratings yet
An Introduction To Ordinary Differential Equations M Files: Atlab
37 pages
Signal System Experiment File
PDF
No ratings yet
Signal System Experiment File
30 pages
Matlab
PDF
100% (3)
Matlab
134 pages
holly moore good stuff
PDF
No ratings yet
holly moore good stuff
36 pages
B C I D J E: Homework 1
PDF
No ratings yet
B C I D J E: Homework 1
13 pages
1 MATLAB Intro
PDF
No ratings yet
1 MATLAB Intro
21 pages
Numerical Analysis With Matlab (CE325) Assignment 1: General Instructions
PDF
No ratings yet
Numerical Analysis With Matlab (CE325) Assignment 1: General Instructions
2 pages
MATLAB Workbook: Vector Calculus For Engineers
PDF
No ratings yet
MATLAB Workbook: Vector Calculus For Engineers
33 pages
Part 2
PDF
No ratings yet
Part 2
7 pages
S Dixit
PDF
No ratings yet
S Dixit
57 pages
Lab HW-2
PDF
No ratings yet
Lab HW-2
2 pages
CM1-LAB_ASSIGNMENT[1]
PDF
No ratings yet
CM1-LAB_ASSIGNMENT[1]
26 pages
Applied Physics Exp 3 - Intro To Matlab
PDF
No ratings yet
Applied Physics Exp 3 - Intro To Matlab
11 pages
Numerical Methods
PDF
No ratings yet
Numerical Methods
44 pages
Numeco 3001b 05 Bagundang, Almanzur S.
PDF
No ratings yet
Numeco 3001b 05 Bagundang, Almanzur S.
14 pages
MIT6 094IAP10 Assn01
PDF
No ratings yet
MIT6 094IAP10 Assn01
12 pages
MATLAB Programming For Numerical Computations
PDF
No ratings yet
MATLAB Programming For Numerical Computations
12 pages
Itc Mathlab TP
PDF
100% (1)
Itc Mathlab TP
43 pages
Poc Lab 1
PDF
No ratings yet
Poc Lab 1
11 pages
Matlab Tutorial 1
PDF
No ratings yet
Matlab Tutorial 1
29 pages
Lab Report Title Page
PDF
No ratings yet
Lab Report Title Page
11 pages
4 - Matlab Mathemathical Modelling
PDF
No ratings yet
4 - Matlab Mathemathical Modelling
20 pages
5 - MatLab Tutorial
PDF
No ratings yet
5 - MatLab Tutorial
3 pages
Mat3012 Numerical Methods (Lab Applicatoins) : Bahcesehir University
PDF
No ratings yet
Mat3012 Numerical Methods (Lab Applicatoins) : Bahcesehir University
29 pages
Num Method 03 Functions MAE284 SP20
PDF
No ratings yet
Num Method 03 Functions MAE284 SP20
50 pages
Submit, Be Patient and Wait - Attachments Take A While To Upload. Hitting Submit Multiple Times Will Result in Multiple Submissions
PDF
No ratings yet
Submit, Be Patient and Wait - Attachments Take A While To Upload. Hitting Submit Multiple Times Will Result in Multiple Submissions
7 pages
Advanced MATLAB Code
PDF
No ratings yet
Advanced MATLAB Code
43 pages
Matlab-Ex (Chp#6) .
PDF
No ratings yet
Matlab-Ex (Chp#6) .
16 pages
Inline Functions and Plotting in Matlab
PDF
No ratings yet
Inline Functions and Plotting in Matlab
5 pages
6 MatLab Tutorial Problems
PDF
No ratings yet
6 MatLab Tutorial Problems
27 pages
An Introduction To Sci Lab
PDF
No ratings yet
An Introduction To Sci Lab
9 pages
Matlab Notes 2
PDF
No ratings yet
Matlab Notes 2
36 pages
Group5A_GG_Act.1
PDF
No ratings yet
Group5A_GG_Act.1
10 pages
Cours Traitement Signal P1
PDF
No ratings yet
Cours Traitement Signal P1
28 pages
4WM20 - Exercises Lecture 2: 1 Creating Your Own Bode Plot
PDF
No ratings yet
4WM20 - Exercises Lecture 2: 1 Creating Your Own Bode Plot
3 pages
Signals and Systems - Prof - Ishit Shah
PDF
No ratings yet
Signals and Systems - Prof - Ishit Shah
35 pages
Signals and Systems - Prof - Ishit Shah
PDF
No ratings yet
Signals and Systems - Prof - Ishit Shah
35 pages
Homeworks Array String
PDF
No ratings yet
Homeworks Array String
4 pages
PCS Lab-1
PDF
No ratings yet
PCS Lab-1
9 pages
MIT6 094IAP10 Assn02
PDF
No ratings yet
MIT6 094IAP10 Assn02
10 pages
MATLAB programs (1)
PDF
No ratings yet
MATLAB programs (1)
26 pages
Unit Three Partb-1
PDF
No ratings yet
Unit Three Partb-1
10 pages
Matlab Final record
PDF
No ratings yet
Matlab Final record
16 pages
Lab1 DSP
PDF
No ratings yet
Lab1 DSP
15 pages
Homework 2
PDF
No ratings yet
Homework 2
14 pages
EE105 Matlab Tutorial
PDF
No ratings yet
EE105 Matlab Tutorial
3 pages
Matlab Workbook: CME 102 Winter 2008-2009
PDF
No ratings yet
Matlab Workbook: CME 102 Winter 2008-2009
55 pages
LAB1
PDF
No ratings yet
LAB1
6 pages
EE 105: MATLAB As An Engineer's Problem Solving Tool
PDF
No ratings yet
EE 105: MATLAB As An Engineer's Problem Solving Tool
3 pages
Lab 1-Introduction To Matlab
PDF
No ratings yet
Lab 1-Introduction To Matlab
8 pages
Homework Matlab
PDF
No ratings yet
Homework Matlab
3 pages