Plot sin wave with changing amplitude
古いコメントを表示
Hi,
I plot Bx and By but I want to changing amplitude as the follwing
B0 = 0.45;
wav = 0.0223;
z1= 1.75
err= 10
z = linspace(0,z1,10000);
segb = B0/err;
seglam = wav/err;
Bx = (B0+segb).*sin((2 * pi * z) / (wav+seglam));
By = (B0+segb).*cos((2 * pi * z) / (wav+seglam));
plot(z,Bx,z,By)
title('Introduce errors')
it work for fixed err but it is suppose that Bx changing in z direction with error +-10 %
The output from this code as

The true output should be

How I can do that
5 件のコメント
Voss
2021 年 12 月 26 日
Are there supposed to be random fluctuations in the amplitude of Bx and By?
Image Analyst
2021 年 12 月 26 日
What function defines the amplitude? You need to do something like
amplitude = whatever, some vector as long as Bx and By
% Create amplitude modulated signal
signal = amplitude .* Bx; % Make sure you use dot star and not just star.
DGM
2021 年 12 月 27 日
In case it's still not clear, you're getting exactly what you've written. You've asserted that the error is a constant value.
err= 10 % this is a constant
segb = B0/err; % this is a constant too
seglam = wav/err; % so is this
Bx = (B0+segb).*sin((2 * pi * z) / (wav+seglam));
The output amplitude is B0+segb, which is the same as saying 1.1*B0. The amplitude never changes because 1.1 never changes.
As an aside, I have to question whether the error is supposed to simultaneously influence both amplitude and frequency, or whether that's supposed to be two separate error sources.
Ali Gamal
2021 年 12 月 28 日
Ali Gamal
2021 年 12 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Map Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




