フィルターのクリア

how can I connect multiple lines into a line in a graph?

7 ビュー (過去 30 日間)
alp bora özün
alp bora özün 2023 年 5 月 23 日
回答済み: Sufiyan 2023 年 5 月 24 日
I wan to connect these lines like this
  3 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 5 月 23 日
編集済み: Dyuman Joshi 2023 年 5 月 23 日
How do you obtain the plot? Share any code you have.
alp bora özün
alp bora özün 2023 年 5 月 23 日
syms s
w=(2/s^2);
w1=2/s;
w2=-(2/s^2);
w3=0;
gs=(0.346*s+0.1538)*w+(8.38/s);
gs2=(0.346*s+0.1538)*w1+(8.38/s);
gs3=(0.346*s+0.1538)*w2+(8.38/s);
gs4=(0.346*s+0.1538)*w3+(8.38/s);
fonk=ilaplace(gs)
fonk2=ilaplace(gs2)
fonk3=ilaplace(gs3)
fonk4=ilaplace(gs4)
figure(1);hold on; grid on;
g1=fplot(fonk,[0 1],'LineWidth',2);
g2=fplot(fonk2,[1 3],'LineWidth',2);
g3=fplot(fonk3,[3 4],'LineWidth',2);
g4=fplot(fonk4,[4 6],'LineWidth',2);
xlabel('t(s)');
ylabel('Vq(V)');

サインインしてコメントする。

採用された回答

Sufiyan
Sufiyan 2023 年 5 月 24 日
You can use "plot" directly instead of "fplot" as shown in the code below.
% Define the functions and their domains
syms s
w=(2/s^2);
w1=2/s;
w2=-(2/s^2);
w3=0;
gs=(0.346*s+0.1538)*w+(8.38/s);
gs2=(0.346*s+0.1538)*w1+(8.38/s);
gs3=(0.346*s+0.1538)*w2+(8.38/s);
gs4=(0.346*s+0.1538)*w3+(8.38/s);
fonk=ilaplace(gs);
fonk2=ilaplace(gs2);
fonk3=ilaplace(gs3);
fonk4=ilaplace(gs4);
% Define the x-coordinates for each line
x1 = linspace(0, 1, 100);
x2 = linspace(1, 3, 200);
x3 = linspace(3, 4, 100);
x4 = linspace(4, 6, 200);
% Define the y-coordinates for each line
y1 = double(subs(fonk, x1));
y2 = double(subs(fonk2, x2));
y3 = double(subs(fonk3, x3));
y4 = double(subs(fonk4, x4));
% Concatenate the coordinates
x = [x1, x2(2:end), x3(2:end), x4(2:end)];
y = [y1, y2(2:end), y3(2:end), y4(2:end)];
% Plot the concatenated line
figure(1); hold on; grid on;
plot(x, y, 'LineWidth', 2);
xlabel('t(s)');
ylabel('Vq(V)');
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by