I'm beginner in Matlab, I'm designing an app via 'App Designer'. I have a function called 'langmuir.m', I wanted this function to be performed inside button pushed function alongside other calculus. Please help me! My Langmuir.m function as follows:
function output = Langmuir(a,y, x)
n=a(1).*a(2).*y./(1.+(a(2).*y));
output = sum((x-n).^2);
end
And my code for the button pushed function in GUI is as follows:
function LangmuirButtonPushed(app, event)
x=[1,2,3,4]
y=[5,6,7,8]
load('Langmuir.m')
a = [4 0.7];
SSE = Langmuir(a,y, x);
fminsearch(@langmuir,a,[],x, y);
fun=@(x)ans(1).*ans(2).*x./(1.+(ans(2).*x))
fplot(app.UIAxes,fun,[0,130])
hold
plot(app.UIAxes,x,y,'ob')
It is not loading Langmuir.m and says 'Error using load Number of columns on line 2 of ASCII file Langmuir.m must be the same as previous lines.' What can I do?