Unrecognized function or variable 'phload.'
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
numdesigns=5
nelx=30;
nely=30;
for i=1:numdesigns
volfrac=round((.3+(.8-.3)*rand(1,1)),1); %random # from .3 to .8
penal=3; %paper said "typically 3"
rmin=round((1.2+(1.5-1.2)*rand(1,1)),1); %filter size- range or?
%primary load is set to -1 (and applied at bottom right of beam)
%phantom load randomly changes magnitude + location
%added code lines 91+
phload=round((.1+(.3-.1)*rand(1,1)),2); %random magnitude from 0.1 to 0.3
phlocation=randi([round(2*(nelx+1)/3) nelx+1], 1,1); %from 2/3 beam to right end
toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation)
end
I get that both phload and phlocation are unrecognized. don't know why.
the beginning of the function looks like this:
function toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation);
Error says this:
Unrecognized function or variable 'phload'.
Error in toploadph>FE (line 94)
F(2*nelx*(phlocation-1)+ 2,2)=phload; %location represents vertical columns
Error in toploadph (line 16)
[U]=FE(nelx,nely,x,penal);
Error in generatetop99 (line 64)
toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation)
1 commentaire
Sudhakar Shinde
le 27 Oct 2020
Modifié(e) : Sudhakar Shinde
le 27 Oct 2020
Make sure there is no any 'clear' command used. Check if unfortunately this varible get cleared by any way.
Réponses (1)
Walter Roberson
le 27 Oct 2020
You are passing phload into toploadph, but toploadph is not passing it into FE which needs it.
We can also predict that FE is not a nested function within toploadph -- if it were nested, then it would have access to the parameters passed in to the nesting function.
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!