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!




