MATLAB CODE Given the following data x5065 y4054 Calculate G

MATLAB CODE***

Given the following data

x=-5:0.6:5;
y=-4:0.5:4;

Calculate G as follows:G = n sigma i=1 |xi-yi/xi where n is the number of data points in vectors x and y.

Copy and paste your code below as it would appear in a script file.

Solution

Matlab Code

x=-5:0.6:5;
y=-4:0.5:4;
G = 0;
for i=1:length(x)
    G = G + abs(x(i)-y(i))/x(i);
end
disp(G)

MATLAB CODE*** Given the following data x=-5:0.6:5; y=-4:0.5:4; Calculate G as follows:G = n sigma i=1 |xi-yi/xi where n is the number of data points in vectors

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site