% Define the function
x = linspace(0, 4*pi, 1000);
y = sin(x) + 0.5*sin(2*x);
% Compute the Fourier transform
Y = fft(y);
% Plot the original function and its Fourier transform
figure;
subplot(2,1,1);
plot(x, y);
title('Original Function');
xlabel('Time');
ylabel('Amplitude');
subplot(2,1,2);
plot(abs(Y));
title('Fourier Transform');
xlabel('Frequency');
ylabel('Magnitude');
To embed this project on your website, copy the following code and paste it into your website's HTML: