Step 1

  • Create a file called "main.m" in your home directory. Add the following lines to your main.m file: function handles = main() % main is a function clear all; % clear variables close all; % close all open figures clc; % clear screen mp1_data; % load data file Then you have to fill "main.m" with function calls to functions that you are going to write:
    d = % function call to find_d (Step 2)

    X = % function call to build_Xvec (Step 3)

    h = % function call to find_h (Step 4)

    Y = % function call to build_Yvec (Step 5)

    len = % function call to spr_length (Step 6)

    From Step 2 to Step 6, at each step, you need to add a line of function call in "main.m". (Note: for more information on how to make a function call, please check section 4.2 in Getting Started with MATLAB and lecture 2). At the same time you must implement the function that is being called and put the function code in the corresponding file. The order you call each function should be exactly the same as specified above. The result (output) of each function is stored in a variable. For example, the result of "find_d" is stored in a variable (which is a vector) "d". We shall edit "main.m" in step 7 to create a loop. Finally, in step 8, we will create the code for plotting the solutions.

Step 2 (find_d.m)

  • Write a function called "find_d" and store it in file "find_d.m". This function solves the values of the horizontal distances between each balloon (using equation_3). It accepts 2 parameters "D" and "K" (in this order). It returns a row vector of the values of the distance between each balloon. In "main.m", write a function call to "find_d" and store the return value in a vector called d. ............ equation_3

  • I did part one but for part two i have no clue what to do.