1 page matlab finish in 5 hrs 1 – writinghub.net

1 page matlab finish in 5 hrs 1 – writinghub.net

Instructions for 1 page assignment

MATLAB SCRIPT:

>>>>>Main_Script _Assignment_3_0.m
% This is a script file to test your function.
% YOU DON’T NEED TO SUBMIT THIS FILE.
% You can test your function using an array of discrete numbers of x and y.
clc
clear
%% You can test your function with any set of discrete numbers, such as with following numbers
x=[1,5,11,26,46,56,66,76,81];
y=[11,15,21,36,56,66,76,86,91];

int_y_dx = Lastname_studentnumber_composite_integration(x,y)

>>>>>Lastname_studentnumber_composite_integration.m
function integral_of_y_dx = Lastname_studentnumber_composite_integration(x,y)
%
% Name:
% Student ID:

% WRITE YOUR CODE HERE
%
% Hint: First determine the number of consecutive equal intervals
% Then Evaluate the integral over the number of consecutive intervals

p=length(x);
q=length(y);

% Check whether x and y have same length

% WRITE YOUR CODE HERE

x_interval = diff(x);
n_total = length(x_interval);

integral_of_y_dx = 0;
keep_going = 1;

while keep_going
% —————————————————-+
% Determine the number of consecutive equal intervals |
% —————————————————-+

% WRITE YOUR CODE HERE

% —————————————————————+
% Evaluate the integral over the number of consecutive intervals |
% —————————————————————+

% WRITE YOUR CODE HERE

end

Writing Hub