Undefined function 'bsxfun' for input arguments of type 'sym'.
Mostrar comentarios más antiguos
Trying to run the following code. I apologize for the length of the question, but my knowledge of MATLAB is very basic, and I want to make sure I provide all needed information:
meanvr = [.56552 0.195165 2.835 .5500];
vrhi = [.861332 0.250000 3.000 .41844];
vrlo = [.405612 0.175165 2.755 .37063];
syms AS JS Fe Pf
Svr = [AS JS Fe Pf];
mx = [0, JS*Fe*Pf;
JS, AS];
reps=500;
rand('state',sum(100*clock));
numvrs = length(meanvr);
allvrs = rand(reps,numvrs);
allvrs = allvrs.*repmat(vrhi-vrlo,reps,1) + repmat(vrlo,reps,1);
for rr = 1:reps
disp(rr);
realmx=subs(mx,Svr,allvrs(rr,:));
[lambdas,lambda1,W,w,V,v]=eigenall(realmx);
sensmx=v*w'/(v'*w);
elastmx=(sensmx.*realmx)/lambda1;
alllams(rr,1)=lambda1;
for xx=1:numvrs
diffofvr=subs(diff(mx,Svr(xx)),Svr,allvrs(rr,:));
vrsens(xx)=sum(sum(sensmx.*diffofvr));
end;
allelasts(rr,:)=((vrsens.*allvrs(rr,:))/lambda1);
end;
realmx=subs(mx,Svr,meanvr);
[lambdas,lambda1,W,w,V,v]=eigenall(realmx);
meanlam1=lambda1; sensmx=v*w'/(v'*w);
elastmx=(sensmx.*realmx)/lambda1;
meansens = zeros(1,numvrs);
for xx = 1: numvrs
diffofvr=subs(diff(mx,Svr(xx)),Svr,meanvr);
meansens(xx) = sum(sum(sensmx.*diffofvr));
end;
meanelast=((meansens.*meanvr)/lambda1);
maxlams=zeros(1,numvrs);
for rate = 1:numvrs
vrates=meanvr; vrates(rate)=vrhi(rate);
realmx=subs(mx,Svr,vrates);
[lambdas,lambda1,W,w,V,v]=eigenall(realmx);
maxlams(rate)=lambda1;
end;
disp(Svr); disp(maxlams)
disp((maxlams-ones(1,numvrs)*meanlam1)/meanlam1)
correls=corrcoef([allvrs,alllams]);
disp(Svr); disp((correls(numvrs+1,1:numvrs)).^2);
disp(Svr); disp(meanelast);
disp(min(double(allelasts))); disp(max(double(allelasts)));
disp(mean(double(allelasts))); disp(std(double(allelasts)));
disp(Svr); CLup=zeros(1,numvrs); CLlo=zeros(1,numvrs);
for vr=1:numvrs
x=sort(allelasts(:,vr));
CLup(vr)=x(1+round((reps-1)*0.975));
CLlo(vr)=x(1+round((reps-1)*0.025));
end
disp(CLup); disp(CLlo);
But I get the following error:
"Undefined function 'bsxfun' for input arguments of type 'sym'.
Error in cov (line 93)
xc = bsxfun(@minus,x,sum(x,1)/m); % Remove mean
Error in corrcoef>correl (line 209)
r = cov(x);
Error in corrcoef (line 92)
r = correl(x);
Error in Thesis92d (line 63)
correls=corrcoef([allvrs,alllams]);"
4 comentarios
Azzi Abdelmalek
el 26 de Sept. de 2013
I think you can make your question more clear and breve
Jan
el 26 de Sept. de 2013
What is your question? The error message clearly tell, that bsxfun cannot be applied for a sym variable. So how can we help then?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
