Where am I making the mistake in my coding? Below attached is the instructions to follow. Can you please specify and correct the line in order to obtain desired result please?

1 次查看(过去 30 天)
syms x y; illum = 300/(4*pi*((x - 5)^2 + (y - 2)^2 + 3^2))
ezcontourf(illum, [0 10 0 4]); colormap('gray'); axis equal tight
subs(illum, {x, y}, {0, 0})
subs(illum, {x, y}, {5, 2})
light2 = inline(vectorize('150/(4*pi*((x - d)^2 + (y - 2)^2 + 3^2))'), 'x', 'y', 'd')
[X,Y] = meshgrid(0:0.1:10, 0:0.1:4); contourf(light2(X, Y, 3) + light2(X, Y, 7), 20); colormap('gray'); axis equal tight
contourf(light2(X, Y, 2) + light2(X, Y, 8), 20); colormap('gray'); axis equal tight
contourf(light2(X, Y, 1) + light2(X, Y, 9), 20); colormap('gray'); axis equal tight
d = 0:0.1:5; plot(d, light2(0, 0, d) + light2(0, 0, 10 - d))
d = 0:0.1:5; plot(d, light2(5, 0, d) + light2(5, 0, 10 - d))
hold on; plot(d, light2(0, 0, d) + light2(0, 0, 10 - d)); hold off
syms d; eqn = inlinechar(light2(0, 0, d) + light2(0, 0, 10 - d) - light2(5, 0, d) - light2(5, 0, 10 - d)))
fzero(eqn, [0 5])
light2(0, 0, 1.441) + light2(0, 0, 10 - 1.441)
light3 = inline(vectorize('100/(4*pi*((x - d)^2 + (y - 2)^2 + 3^2))'), 'x', 'y', 'd')
[X,Y] = meshgrid(0:0.1:10, 0:0.1:4); contourf(light3(X, Y, 1) + light3(X, Y, 5) + light3(X, Y, 9), 20); colormap('gray'); axis equal tight
d = 0:0.1:5;
for x = 0:0.5:5
plot(d, light3(x, 0, d) + light3(x, 0, 5) + light3(x, 0, 10 - d))
hold on
end
hold off
  1 个评论
Image Analyst
Image Analyst 2019-10-29
Well one glaringly obvious problem is making it hard to read by putting WAY too many commands/functions in a single line of code.
That, plus not indenting correctly. Type control-a, control-i to fix the indentation.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by