For every time stamp t do

I have 2 signals
% signal one
f=60;
t=(0:1/(f*100):1);
a=1;
phi=0;
y1=a*sin(1*pi*f*t+phi);
plot(t,y1)
% signal two
hold on
f=10;
t=(0:1/(f*10):1);
a=0.5;
phi=0;
y2=a*sin(1*pi*f*t+phi);
plot(t,y2,'r')
I want to write a code that for every time stamp t do the below, but I do not know how
for every time stamp t do
obtain arriving y1(t) for time stamp t
if t matches the time stamp of latest y2(t)
norm(y1(t)-y2(t))
end
end

回答 (1 件)

Cris LaPierre
Cris LaPierre 2022 年 9 月 30 日

0 投票

Ch 12 of MATLAB Onramp introduces how to write if statements and for loops.

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

タグ

質問済み:

NA
2022 年 9 月 30 日

回答済み:

2022 年 9 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by