I have query in graph plotting.

1 view (last 30 days)
Amy Topaz on 14 Apr 2022
Commented: Rik on 24 May 2022
I have the below function. I need to find the surface plot
z1 = -4:0.002:4;
a11 = -4:0.002:4;
G = atan(((0.03 + a11)./z1)) + atan((0.05 - a11)./z1);
G1 = atan(((0.03 + a11)./z1));
G2 = atan((0.05 - a11)./z1);
G = G1 + G2
%If I find the surface plot of each G1 and G2, I get the following
But when I am plotiing for G, I get the below surface plot. Is it correct?
KALYAN ACHARJYA on 14 Apr 2022
@Amy Topaz Have you provided the detail requirements, like G1 & G2?
Rik on 24 May 2022
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

Davide Masiello on 14 Apr 2022
Edited: Davide Masiello on 14 Apr 2022
Try using meshgrid
z1 = -4:0.1:4;
a11 = -4:0.1:4;
[z1,a11] = meshgrid(z1,a11);
G = atan(((0.03 + a11)./z1)) + atan((0.05 - a11)./z1);
G1 = atan(((0.03 + a11)./z1));
G2 = atan((0.05 - a11)./z1);
G = G1 + G2;
surf(z1,a11,G1)
surf(z1,a11,G2)
surf(z1,a11,G)

Star Strider on 14 Apr 2022
Using fsurf
G = @(a11,z1) atan(((0.03 + a11)./z1)) + atan((0.05 - a11)./z1);
G1 = @(a11,z1) atan(((0.03 + a11)./z1));
G2 = @(a11,z1) atan((0.05 - a11)./z1);
G = @(a11,z1) G1(a11,z1) + G2(a11,z1);
figure
fsurf(G, [-1 1 -1 1]*4)
colormap(turbo)
colorbar
.