How to shader the stability area ?
4 次查看(过去 30 天)
显示 更早的评论
x0 = -5; x1 = 5; Nx = 301;
y0 = -5;
y1 = 5;
Ny = 301;
xv = linspace(x0,x1,Nx);
yv = linspace(y0,y1,Ny);
[x,y] = meshgrid(xv,yv);
h = x + i*y;
g = -(118224803259250638877444968353370600910051934512743.*h.^9 - 237428789745399453892107883780168786708111749629870080.*h.^6 + 8178108279897162920859527218771768255678191550351802368.*h.^3 + 196159429230833773869868419475239575503198607639501078528)./(32*(2846779580313514030178888018748426609395855663955.*h.^9 + 1850166005134036192585345683694925738701755489714176.*h.^6 + 31532715869896263823264459664257271745814644580679680.*h.^3 - 6129982163463555433433388108601236734474956488734408704))
gmag = abs(g);
% Plot contours of gmag
contour(x,y,gmag,[1 1],'b-')
axis([x0,x1,y0,y1]);
axis('square');
xlabel('Real ')
ylabel('Imag ')
grid on
0 个评论
采纳的回答
Star Strider
2018-7-16
What region do you want to plot?
You appear to have specified a transfer function. Plotting it is straightforward:
f = @(h) (25.*h.^8 + 765.*h.^7 + 12423.*h.^6 + 131310.*h.^5 + 962910.*h.^4 + 4944240.*h.^3 + 17191440.*h.^2+36741600.*h + 36741600) ./ (25.*h.^8 -765.*h.^7 + 12423.*h.^6 - 131310*h.^5 + 962910.*h.^4 - 4944240.*h.^3 + 17191440.*h.^2-36741600.*h + 36741600);
hv = linspace(0, 20, 1E+3);
figure
plot(hv, f(hv))
grid
The function quickly approaches zero outside the specified limits I defined for ‘hv’.
4 个评论
Star Strider
2018-7-16
编辑:Star Strider
2018-7-18
Run all the code in my original Answer to find out (repeated here):
f = @(h) (25.*h.^8 + 765.*h.^7 + 12423.*h.^6 + 131310.*h.^5 + 962910.*h.^4 + 4944240.*h.^3 + 17191440.*h.^2+36741600.*h + 36741600) ./ (25.*h.^8 -765.*h.^7 + 12423.*h.^6 - 131310*h.^5 + 962910.*h.^4 - 4944240.*h.^3 + 17191440.*h.^2-36741600.*h + 36741600);
hv = linspace(0, 20, 1E+3);
figure
plot(hv, f(hv))
grid
EDIT — (18 Jul 2018 at 01:04 UTC)
Your edited code is entirely different from your previous code.
I am not certain what you want. Filling in the contours with different colours is straightforward with the contourf function:
contourf(x,y,gmag,[0.001 1],'b-');
colormap([1 0 0; 0 1 0]) % Colour Values < 1 Red, Values >= 1 Green
Change a colormap row to [1 1 1] to make it white if you only want one area coloured.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!