Write a script to generate the signal values for the figure above corresponding to equally-spaced time values ranging from 0 to 6*pi . Assign these time values to the variable Time. Assign the resulting voltage values to the variable signalVoltage. The sinusoidal function is given by the formula: Y=7sin(x) In order to model the clipping at plus or minus 5 Volts, you will need to replace any values of y that are greater than the threshold of 5 with the value 5. Similarly you will need to replace any values of y that are less than with the value -5
My attempt: Time= 0:6*pi Signal voltage = 7sin(time) Plot ( time, signal voltage) Signalvoltagelim([-5,5])
Don’t know what I am doing wrong. What in my script is wrong ?

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 23 日
編集済み: Voss 2023 年 8 月 2 日

2 投票

time=linspace(0,6*pi,500);
Y=7*sin(time);
figure()
subplot(121),plot(time,Y);
ylim([-8 8]);
Y(Y>5)=5; % You can replace by any value, here I have consider 5
Y(Y<-5)=-5% You can replace by any value, here I have consider -5
Y = 1×500
0 0.2644 0.5283 0.7916 1.0537 1.3143 1.5730 1.8295 2.0833 2.3342 2.5818 2.8257 3.0655 3.3010 3.5318 3.7575 3.9778 4.1925 4.4012 4.6037 4.7995 4.9885 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000
subplot(122),plot(time,Y);
ylim([-8 8]);
Or
time=linspace(0,6*pi,500);
Y=7*sin(time);
figure()
plot(time,Y);
hold on;
Y(Y>5)=5; % You can replace by any value, here I have consider 5
Y(Y<-5)=-5% You can replace by any value, here I have consider -5
Y = 1×500
0 0.2644 0.5283 0.7916 1.0537 1.3143 1.5730 1.8295 2.0833 2.3342 2.5818 2.8257 3.0655 3.3010 3.5318 3.7575 3.9778 4.1925 4.4012 4.6037 4.7995 4.9885 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000 5.0000
plot(time,Y);
legend('Original','Clipping')

3 件のコメント

STUDENT
STUDENT 2019 年 10 月 23 日

Where did the 500 come from ?

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 23 日
編集済み: KALYAN ACHARJYA 2019 年 10 月 23 日
Considering 500 vectors elements between 0 and 6Pi, you can choose any other number also
Emile
Emile 2023 年 8 月 2 日
🙏

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

その他の回答 (0 件)

カテゴリ

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

製品

質問済み:

2019 年 10 月 23 日

編集済み:

2023 年 8 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by