Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T1 = 3;
- T2 = 3;
- T3 = 3;
- K = 5;
- function clear_graph()
- w = 0:0.01:5
- Re = K * (w ^ 2 * (T1 * T2 + T2 * T3 + T3 * T1) - 1) ./ -((T1 ^ 2 * w ^ 2 + 1) .* (T2 ^ 2 * w ^ 2 + 1) .* (T3 ^ 2 * w ^ 2 + 1))
- Im = K * (w .* (T1 + T2 + T3 - T1 * T2 * T3 * w ^ 2)) ./ -((T1 ^ 2 * w ^ 2 + 1) .* (T2 ^ 2 * w ^ 2 + 1) .* (T3 ^ 2 * w ^ 2 + 1))
- Ylah = 20 * log10(K / ((T1 * %i * w + 1) .* (T3 * %i * w + 1) .* (T2 * %i * w + 1)))
- Xlah = log10(w)
- subplot(221);
- plot(Re, Im, 'white');
- subplot(223);
- plot(Xlah, Ylah, 'white');
- endfunction
- function draw_graph()
- w = 0:0.01:5
- Re = K * (w ^ 2 * (T1 * T2 + T2 * T3 + T3 * T1) - 1) ./ -((T1 ^ 2 * w ^ 2 + 1) .* (T2 ^ 2 * w ^ 2 + 1) .* (T3 ^ 2 * w ^ 2 + 1))
- Im = K * (w .* (T1 + T2 + T3 - T1 * T2 * T3 * w ^ 2)) ./ -((T1 ^ 2 * w ^ 2 + 1) .* (T2 ^ 2 * w ^ 2 + 1) .* (T3 ^ 2 * w ^ 2 + 1))
- Ylah = 20 * log10(K / ((T1 * %i * w + 1) .* (T3 * %i * w + 1) .* (T2 * %i * w + 1)))
- Xlah = log10(w)
- subplot(221);
- plot(Re, Im, 'blue');
- subplot(223);
- plot(Xlah, Ylah, 'blue');
- endfunction
- //Создание окна
- f = figure();
- f.figure_position = [0, 0];
- f.background = color('white');
- f.figure_size = [1280, 960];
- axes1 = newaxes();
- axes1.axes_bounds = [0,0,0.4,0.4];
- axes1.background = color(255,255,255);
- axes1.auto_clear = "on";
- axes2 = newaxes();
- axes2.axes_bounds = [0,0.6,0.4,0.4];
- axes2.background = color(255,255,255);
- axes2.auto_clear = "on";
- //Создание объекта Slider для ввода T3
- slider1 = uicontrol(f, 'style', 'slider', 'Position', [1000 160 200 20], 'Min', 0.5, 'Max', 5, 'Value', T3, 'SliderStep', [0.1, 0.1]);
- slider1.Callback = 'clear_graph(); t3.string = string(round(slider1.Value * 10) / 10); s1v.string = string(round(slider1.Value * 10) / 10); T3 = round(slider1.Value * 10) / 10; draw_graph();';
- //Создание трех объектов Text для отображения текущего, min и max значений для слайдера
- s1v = uicontrol(f, 'style', 'text', 'Position', [1090 140 30 20], 'String', string(slider1.Value));
- s1min = uicontrol(f, 'style', 'text', 'Position', [1000 180 20 20], 'String', string(slider1.Min));
- s1max = uicontrol(f, 'style', 'text', 'Position', [1180 180 20 20], 'String', string(slider1.Max));
- uicontrol(f, "style", "text", 'Position', [1090 180 20 20], 'String', " T3");
- //Создание объекта Slider для ввода slider2
- slider2 = uicontrol(f, 'style', 'slider', 'Position', [1000 60 200 20], 'Min', 0.5, 'Max', 5, 'Value', T1, 'SliderStep', [0.1, 0.1]);
- slider2.Callback = 'clear_graph(); t1.string = string(round(slider2.Value * 10) / 10); s2v.string = string(round(slider2.Value * 10) / 10); T1 = round(slider2.Value * 10) / 10; draw_graph();';
- //Создание трех объектов Text для отображения текущего, min и max значений для слайдера
- s2v = uicontrol(f, 'style', 'text', 'Position', [1090 40 30 20], 'String', string(slider2.Value));
- s2min = uicontrol(f, 'style', 'text', 'Position', [1000 80 20 20], 'String', string(slider2.Min));
- s2max = uicontrol(f, 'style', 'text', 'Position', [1180 80 20 20], 'String', string(slider2.Max));
- uicontrol(f, "style", "text", 'Position', [1090 80 20 20], 'String', " T1");
- //Создание объекта Edit для ввода значения T3
- t3 = uicontrol(f, 'style', 'edit', 'Position', [1090 715 35 30], 'FontSize', 20, 'String', string(slider1.Value), 'Callback', 'clear_graph(); s1v.string = t3.String; slider1.value = evstr(t3.String); T3 = round(slider1.Value * 10) / 10; draw_graph();');
- //Создание объекта Edit для ввода значения T1
- t1 = uicontrol(f, 'style', 'edit', 'Position', [816 715 35 30], 'FontSize', 20, 'String', string(slider2.Value), 'Callback', 'clear_graph(); s2v.string = t1.String; slider2.value = evstr(t1.String); T1 = round(slider1.Value * 10) / 10; draw_graph();');
- //Создание объекта Edit для ввода значения K
- k = uicontrol(f, 'style', 'edit', 'Position', [980 761 60 30], 'FontSize', 20, 'String', string(K), 'Callback', 'clear_graph(); K = round((evstr(k.String)) * 10) / 10; draw_graph();');
- xstring(1.6,2.63,'$W(p)=\frac K {(\;\;\;\;p+1)(T_2p+1)(\;\;\;\;p+1)}$',0,1)
- gce().font_size = 6
- draw_graph()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement