How to apply formula with if statement
Show older comments
Hello Community,
First time poster so please go easy on me.
I am also very new to matlab. I have just started doing some data fitting and want to do some work using first principles before using the in built data fitting tools.
I wish to fit my data to a log-normal distribution using schmeisers approximation for phi^(-1) and am able to get this done using excel rows to do the mathematics for me. I would rather use a MATLAB if statement to do the mathematics to automate this process in the future and I have had an attempt at this as you can see below

if freqvector < 0.0028
phiminus1 = -(0.2+((1-freqvector).^(0.14)-(1-(1-freqvector)).^0.09)/0.1596)
elseif freqvector > 0.9972
phiminus1 = 0.2 + ((freqvector.^(0.14)-(1-freqvector).^(0.09))/0.1596)
else
phiminus1 = (freqvector.^(0.135) - (1-freqvector).^0.135)/0.1975
end;
frequencyvector is the array i have defined with my F calculations and phiminus1 will be my resulting array to be calculated.
The maths does not agree with my spreadsheet/hand calcs however and will not give the correct values, is someone able to figure out why?
Thank you for taking the time to read!
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!