MATLAB: Cant make the syms function into a fsolve function

fsolvesolvesyms

Hi
Since I've found out that:
syms
Doesn't work in matlab gui, I need to change my code, and Im totally new at the fsolve function, and dont quite how it works, do I need to make a function file to make it work, I've look at many tutorials from mathworks but I still can't make my script work. This is what I need to make into a fsolve function:
example:
L = 12;
A = 0.3;
vaegt = 60;
Rcd = 250;
slag = (1:80)';
test = zeros(size(slag));
syms x
for h = 1:length(slag)
S0 = sqrt((2*x*vaegt*L)/(A*20000000));
kraeft = @(x)((1/1.5).*vaegt.*x./((0.2./slag(h))+0.5*S0))./1.3;
test(h) = solve(kraeft(x)==(Rcd),x);
end
If someone also see a way to make it calculate faster that would be nice :).

Best Answer

There is no problem using syms in a MATLAB GUI that is running interactively. There is only a problem if you attempt to compile or generate code.
Your system is effectively a quadratic, and has a pair of solutions:
(39/32000000000)*Rcd*(39*Rcd*slag*L +/- 39^(1/2)*(Rcd*slag*L*(39*L*Rcd*slag+640000000*A))^(1/2)+320000000*A)/(A*slag*vaegt)
There is no need to fsolve() at all.