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!




