unexpected object of type 'RootOf'
Show older comments
Hi everyone, I am trying to perform a simple curvefitting, but Matlab keeps throwing this error message at me. Does anyone know whats the issue?
It is weird that I only encounter this problem when I try to work with the function Aufheiz6Var, but I get no issues when working with Aufheiz4var and Aufheiz2Var, they are almost exactly the same functions but just different equations.
Error using symengine
Code generation failed due to unexpected object of type
'RootOf'.
res1 = mupadmex('symobj::generateMATLAB',r.s,ano,spa,splitIt);
r = mup2mat(c{1},true,sparseMat,false);
body = mup2matcell(funs, opts.Sparse);
gs=matlabFunction(ilaplace(Zges*rect))
bx=@(start)Aufheiz6var(Res(i-2),Res(i-1),Res(i),Cap(i-2),Cap(i-1),start,Zth,time(i,:),aufheizdauer);
fv(:,1) = funfcn(x,varargin{:});
if i==2
Zth=temp(i,:)/PHI;
Res(i)=Zth(aufheizdauer)-Res(i-1);
bx=@(start)Aufheiz4var(Res(i-1),Res(i),Cap(i-1),start,Zth,time(i,:),aufheizdauer);
AufheizParameter=fminsearch(bx,start);
Cap(i)=AufheizParameter;
end
if i==3
Zth=temp(i,:)/PHI;
Res(i)=Zth(aufheizdauer)-Res(i-1)-Res(i-2);
bx=@(start)Aufheiz6var(Res(i-2),Res(i-1),Res(i),Cap(i-2),Cap(i-1),start,Zth,time(i,:),aufheizdauer);
AufheizParameter=fminsearch(bx,start);
Cap(i)=AufheizParameter;
end
function A=Aufheiz6var(R1,R2,R3,C1,C2,C3,Zth,xm,aufheizdauer)
syms s
Z3=R3/(R3*C3*s+1);
Z2=(R2+Z3)/((R2+Z3)*C2*s+1);
Z1=R1+Z2;
Zges=1/(s*C1+1/Z1);
rect=(1-exp(-s*aufheizdauer))/s;
gs=matlabFunction(ilaplace(Zges*rect))
A=sum((gs(xm)-Zth).^2);
clf;
plot(xm,Zth,'b');
hold on;
plot(xm,gs(xm),'r');
drawnow
end
function A=Aufheiz4var(R1,R2,C1,C2,Zth,xm,aufheizdauer)
syms s
Z2=R2/(R2*C2*s+1);
Z1=R1+Z2;
Zges=1/(s*C1+1/Z1);
rect=(1-exp(-s*aufheizdauer))/s;
gs=matlabFunction(ilaplace(Zges*rect));
A=sum((gs(xm)-Zth).^2);
clf;
plot(xm,Zth,'b');
hold on;
plot(xm,gs(xm),'r');
drawnow
end
Accepted Answer
More Answers (0)
Categories
Find more on Conversion Between Symbolic and Numeric in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

