How to combine input functions

7 ビュー (過去 30 日間)
Thomas Garnett
Thomas Garnett 2013 年 3 月 13 日
I am trying to write a code for a transfer function, I have to use an input signal of a half sine wave with a period of 0.3s so from 0s to 0.15s this needs to be the input signal, then from 0.151s to 10s the input function should be 0. I know you can use gensig for the sin function but I cant figure out how to combine the two inputs for the response.
Thanks for your help!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 13 日
te=0.3
fe=1/te
t1=0:.001:0.15
y1=sin(2*pi*fe*t1)
t2=0.151:0.001:1
y2=t2*0
t=[t1 t2]
y=[y1 y2]
plot(t,y)
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 13 日
編集済み: Azzi Abdelmalek 2013 年 3 月 13 日
%or
te=0.3
fe=1/te
t=0:0.001:1
y=(heaviside(t)-heaviside(t-0.151)).*sin(2*pi*fe*t)
plot(t,y)
Thomas Garnett
Thomas Garnett 2013 年 3 月 13 日
ah was trying to do this sin(wt)*t haha. thanks for your help! it worked perfectly

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by