Posts

Showing posts from April, 2021

Programming Using GNU Octave

Image
  Questions: 1 A small object is projected from a toy gun to travel some distance and land on the ground. 1. Write a function to model the dynamics of the object in Octave called f_trajectory. f_trajectory will accept following arguments in the same order (measured in the given units). Also specify the default values for each parameter as given in brackets. i. h(5) : Initial height of the projectile (m) ii. g(9.81) : acceleration from gravity (m/s/s) iii. v(25) : speed at initial release (m/s) iv. theta(π/4) : angle of release (radians) v. t : a vector representing the points in time For default values of t check if the variable ‘exist’ with name ‘t’ and type ‘var’ if not initialize it as a row vector starting from 0 and goes to 5 with increments of 0.1. If x is distance and y is height, the equations below describe their dependence on time and all the other parameters. 𝑥(𝑡)=𝑣𝑐𝑜𝑠(𝜃)𝑡 ----------------(eq1) 𝑦(𝑡)=ℎ+𝑣𝑠𝑖𝑛(𝜃)𝑡− 12𝑔𝑡2 ---------------(eq2) Convert the above e