# How to do Surf plot

1 view (last 30 days)
safi58 on 25 Jan 2017
Commented: safi58 on 26 Jan 2017
Q=0.25;
L=5;
a=1-cos(2*pi*D1/fn);
x=(pi*D1)/(fn*L)*sin(2*pi*D1/fn);
y=cos(2*pi*D1/fn)*((4*Q/pi*fn)+((pi^2*D1/fn^2*L)*(0.5-D1))-1);
z=(pi^2*D1/fn^2*L)*(0.5-D1);
m=4*Q/pi*fn;
deno=1+x+y+z+m;
Gdc1=a/deno;
Hi I want to plot a surface of Gdc where D1=0.1:0.1:0.5 and fn=0.5:0.1:1.5
How can I do it?

Walter Roberson on 25 Jan 2017
Q = 0.25;
L = 5;
[D1, fn] = ndgrid(0.1:0.1:0.5, 0.5:0.1:1.5);
D1_fn = D1./fn; %optimization
a = 1 - cos(2*pi*D1_fn);
x = (pi*D1) ./ (fn*L) .* sin(2*pi*D1_fn);
y = cos(2*pi*D1_fn) .* ((4*Q/pi*fn) + ((pi^2*D1_fn./fn*L) .* (0.5-D1)) - 1);
z = (pi^2*D1_fn./fn*L) .* (0.5-D1);
m = 4*Q/pi * fn;
deno = 1+x+y+z+m;
Gdc1 = a ./ deno;
surf(D1, fn, Gdc1, 'edgecolor', 'none')
safi58 on 26 Jan 2017
thank you so much

### Categories

Find more on 2-D and 3-D Plots 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!