- #1
kubekas
- 10
- 0
Hi there every one
I need some help with the following function:
function cc = find_cc(n)
global nu
cc(1)=(-8.*i.*nu1-3.*n.^2-5+4.*i.*nu1.*n-4.*n)./n./(-n-2+4.*i.*nu1);
cc(2)=(3.*n.^2+2.*n+4)./n./(-n-2+4.*i.*nu1);
cc(3)=-(n-1).*(n+1)./n./(-n-2+4.*i.*nu1);
end
where
\nu is abitrary variable. cc(1), cc(2) and cc(3) are entries of a cc(3,1) matrix. Each time I run the above function I get the following message:
"In an assignment A(I) = B, the number of elements in B and
I must be the same"
I guess the problem here is \nu because if I set \nu to 1 the it works. But I want \new to be abbitrary. The above function is called by this function
function vs=reg_series(s)
global nu;
cc1=find_cc(1);
cc2=find_cc(2);
cc3=find_cc(3);
aa0=1;
aa(1)=aa0*cc1(1);
aa(2)=aa0*cc2(2)+aa(1)*cc2(1);
aa(3)=aa0*cc3(3)+aa(1)*cc3(2)+aa(2)*cc3(1);
sn=s.^3;
ss=aa0+aa(1).*s+aa(2).*s.^2+aa(3).*s.^3;
dss_ds=aa(1)+2.*s.*aa(2)+3.*s.^2.*aa(3);
asn=ones(length(s));
nn=4;
while ((abs(nn*asn(length(asn)))>1e-18) && (nn<500))
cct=find_cc(nn);
aa(nn)=aa(nn-1)*cct(1)+aa(nn-2)*cct(2)+aa(nn-3)*cct(3);
dss_ds=dss_ds+sn.*nn*aa(nn);
sn=s.*sn;
asn=aa(nn).*sn;
ss=ss+asn;
nn=nn+1;
end
dss_dz=-2*dss_ds;
vs=ss./dss_dz;
end
to generate a series with \nu as abitrary function. If I use "syms" on to keep \nu as a variables in the function cc = find_cc(n) above, then function vs=reg_series(s) is given me the following error message after the second last end command
"Function 'gt' is not defined for values of class 'sym'."
ANY HELP GUYS?
Amos
I need some help with the following function:
function cc = find_cc(n)
global nu
cc(1)=(-8.*i.*nu1-3.*n.^2-5+4.*i.*nu1.*n-4.*n)./n./(-n-2+4.*i.*nu1);
cc(2)=(3.*n.^2+2.*n+4)./n./(-n-2+4.*i.*nu1);
cc(3)=-(n-1).*(n+1)./n./(-n-2+4.*i.*nu1);
end
where
\nu is abitrary variable. cc(1), cc(2) and cc(3) are entries of a cc(3,1) matrix. Each time I run the above function I get the following message:
"In an assignment A(I) = B, the number of elements in B and
I must be the same"
I guess the problem here is \nu because if I set \nu to 1 the it works. But I want \new to be abbitrary. The above function is called by this function
function vs=reg_series(s)
global nu;
cc1=find_cc(1);
cc2=find_cc(2);
cc3=find_cc(3);
aa0=1;
aa(1)=aa0*cc1(1);
aa(2)=aa0*cc2(2)+aa(1)*cc2(1);
aa(3)=aa0*cc3(3)+aa(1)*cc3(2)+aa(2)*cc3(1);
sn=s.^3;
ss=aa0+aa(1).*s+aa(2).*s.^2+aa(3).*s.^3;
dss_ds=aa(1)+2.*s.*aa(2)+3.*s.^2.*aa(3);
asn=ones(length(s));
nn=4;
while ((abs(nn*asn(length(asn)))>1e-18) && (nn<500))
cct=find_cc(nn);
aa(nn)=aa(nn-1)*cct(1)+aa(nn-2)*cct(2)+aa(nn-3)*cct(3);
dss_ds=dss_ds+sn.*nn*aa(nn);
sn=s.*sn;
asn=aa(nn).*sn;
ss=ss+asn;
nn=nn+1;
end
dss_dz=-2*dss_ds;
vs=ss./dss_dz;
end
to generate a series with \nu as abitrary function. If I use "syms" on to keep \nu as a variables in the function cc = find_cc(n) above, then function vs=reg_series(s) is given me the following error message after the second last end command
"Function 'gt' is not defined for values of class 'sym'."
ANY HELP GUYS?
Amos