Question

I have some working code that does amplitude modulation and plots it. However I'm trying to change the way the modulation looks (the y variable) so it looks like an egg shape. I found an equation/website that looks good http://www16.ocn.ne.jp/~akiko-y/Egg/index_egg_E.html but I'm not to sure how to convert that into matlab/octave code to change the y variable

%test_amplitude modultaion
fs=1000;
t=linspace(0,2*pi,fs);

mt=1*sin(100*t); %signal you want to use
y=mt.*(1+cos(1*t+pi));%modulation equation, use pi to shift over 90 deg to start at 0

y=y';
y_norm=(y(:,1)/max(abs(y(:,1)))*.8); %normalize signal

plot(y_norm)

PS: this is matlab/octave code

Was it helpful?

Solution

Using the equations given on the page you linked:

a = 2*pi;
b = a; % change this depending on the shape of the egg you want

mt=1*sin(100*t); %signal you want to use
y = mt.*sqrt((a-b)-2*t + sqrt(4*b*t + (a-b)^2)).*sqrt(t)/sqrt(2); % modulation

The rest of your code is A-OK, although I would probably use plot(t,y_norm) at the end.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top