1 view (last 30 days)

Hey all,

For my research, I needed to calculate some formula, So I searched everywhere, including Matlab file exchange and find nothing about the formula that I needed. Hence I decided to write a function for them and use them in my code. This is the very first time for me to write a function and also the first time to write a math formula. May I please ask you to check if where I do wrong?

Here is the formula:

And here is the function I wrote (I considered O as x and M as y):

function index_agreement = indexagreement(x,y)

%In the name of God - This function calculate

% Detailed explanation goes here

A = sum((y-x).^2);

B = abs(y - (mean(x)));

C = x - abs((mean(x)));

D = sum((B+C).^2);

index_agreement = 1 - (D);

end

Description: I run this function successfully, but I'm not sure about results because I believe they are not reasonable.

I want to thank you all.

Best Regards

Image Analyst
on 15 Feb 2020

Assuming vertical bars mean absolute value and not modulus...

You got C wrong. Try

C = abs(x - abs((mean(x)));

then you need

index_agreement = 1 - abs(A / D);

There may be more errors, but I stopped looking once I found those errors.

Image Analyst
on 16 Feb 2020

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.