I need help with plotting

5 ビュー (過去 30 日間)
Dani German
Dani German 2022 年 4 月 25 日
コメント済み: Dani German 2022 年 4 月 25 日
I can't get it to plot this. I don't know how to write this in matlab up=u1*(t>=0)*(y<=tpulssi)+u2*(t>=tpr*2)*(t<=tpr*2+tpulssi); I need it to plot it like this:
clear
close all
syms t
Zc=300;
R=100;
s=100;
v=300/(1*10^-6)
tpulssi=s/v
k=-1000/tpulssi
p=(R-Zc)/(R+Zc)
s2=25
tpr=s2/v
%heijastuva
t=0:0.001*10^-6:1*10^-6;
u1=k*t+abs(k)*tpulssi;
u2=p*k*t-abs(p*k*(2*tpr+tpulssi));
up=u1*(t>=0)*(y<=tpulssi)+u2*(t>=tpr*2)*(t<=tpr*2+tpulssi);
figure(1)
plot(t,up);
hold on
plot(t,u2)
hold on
plot(t,up)
hold off

採用された回答

Chunru
Chunru 2022 年 4 月 25 日
編集済み: Chunru 2022 年 4 月 25 日
syms t
Zc=300;
R=100;
s=100;
v=300/(1*10^-6)
v = 300000000
tpulssi=s/v
tpulssi = 3.3333e-07
k=-1000/tpulssi
k = -3.0000e+09
p=(R-Zc)/(R+Zc)
p = -0.5000
s2=25
s2 = 25
tpr=s2/v
tpr = 8.3333e-08
%heijastuva
t=0:0.001*10^-6:1*10^-6;
u1=k*t+abs(k)*tpulssi;
u2=p*k*t-abs(p*k*(2*tpr+tpulssi));
% need the .* (or array operation)
up=u1.*(t>=0).*(t<=tpulssi)+u2.*(t>=tpr*2).*(t<=tpr*2+tpulssi);
figure(1)
plot(t,u1, 'DisplayName', 'u1')
hold on
plot(t,u2, 'DisplayName', 'u2')
hold on
plot(t,up, 'k', 'LineWidth', 2, 'DisplayName', 'up');
legend
grid on
hold off
  1 件のコメント
Dani German
Dani German 2022 年 4 月 25 日
Awesome answer, thanks for the help.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by