What causes an "Argument to dynamic structure reference must evaluate to a valid field name" error please? code attached.
Show older comments
This is my code. I have matlab error saying "Argument to dynamic structure reference must evaluate to a valid field name. Can anyone see a problem please?
[x, y, z]=meshgrid(-0.3:0.01:3, -0.3:0.01:3, 0:0.01:1);
s=0.6;
zh=1;
a=0;
xa = -s/2;
xb = s/2;
ya = (-1/3)*s*cos(30);
yb = (-1/3)*s*cos(30);
yc = (2/3)*s*cos(30);
for j=1:length(x)
for k=1:length(y)
for h=1:length(z)
a(j, k, h)=sqrt((xa-j).^2+(ya-k).^2+(-h).^2);
t=90+asin(h./a)-asin((a/0.5)*(sin(90-asin(h./a))));
ha=sqrt((a.^2+0.25)-(cos.(t).*a));
hz=zh-ha;
end
end
end
surf(x, y, hz)
Accepted Answer
More Answers (0)
Categories
Find more on Class Introspection and Metadata in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!