フィルターのクリア

plot half Wave rectied sindus

3 ビュー (過去 30 日間)
David Kenkadze
David Kenkadze 2021 年 11 月 8 日
コメント済み: David Kenkadze 2021 年 11 月 8 日
V(t)=10*sin(8*pi*t). I have to write a script, which will plot rectified Voltage on time scale.
error: __plt2vv__: vector lengths must match
t=0:0.01:1;
n=length(t);
j=10*sin(8*pi*t);
for i=1:1:n
if j>0
y(i)=j;
elseif j<0
y(i)=0;
end
end
plot(y,t)

採用された回答

Chunru
Chunru 2021 年 11 月 8 日
t=0:0.01:1;
y=10*sin(8*pi*t);
y(y<0) = 0;
plot(t, y)
  3 件のコメント
Chunru
Chunru 2021 年 11 月 8 日
The is the logical index in matlab. You can also use y = max(y, 0) to do the same.
David Kenkadze
David Kenkadze 2021 年 11 月 8 日
thank you very much my friend

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by