% FFT Home Work
clc;close all; clear all;
% Generate the sine wave sequences
fs = 1000; % Sampling frequency
ts = 1/fs % Sampling time interval
t = 0:ts:2-ts; % Time vector
n = length(t) % Number of samples
%nfft = 1000; % Length of FFT
% Generate the sine wave
A1 = 4; %amplitude of x1 (first signal)
A2 = 5; %amplitude of x2 (second signal)
A3 = 15; %amplitude of x3 (third signal)
f1 = 2; %frequency of x1 (first signal)
f2 = 4/7; %frequency of x2 (second signal)
f3 = 10; %frequency of x3 (third signal)
x1 = A1*sin(2*pi*f1*t+2*pi/3);
x2 = A2*cos(2*pi*f2*t);
x3 = A3*sin(2*pi*f3*t+5*pi/3);
y = x1 + x2 + x3;
%Calculate FFT
Y = fft(y);
length(Y)
%Y =Y(1:nfft/2);
Mag_Y = abs(Y); %Take the magnitude of fft of Y
%f = (0:nfft/2-1)*fs/nfft;
Phase_Y=angle(Y);
%Plot signal
figure(1)
plot(t,y);
title('Sine wave signal');
xlabel('time (s)');
ylabel('Amplitude');
%Plot FFT
figure(2)
plot(Mag_Y/1000);
xlim([0 length(Y)/40])
title('FFT of the Sine wave signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude of FFT');
%Plot FFT
figure(3)
plot(Phase_Y);
title('FFT of the Sine wave signal');
xlabel('Frequency (Hz)');
ylabel('Phase');
FFT.rar_The Signal_fft
版权申诉
61 浏览量
2022-09-19
22:12:41
上传
评论
收藏 622B RAR 举报
Kinonoyomeo
- 粉丝: 77
- 资源: 1万+
最新资源
- 5.23-Java概述,JDK安装及注释、关键字、标识符、数据类型、变量、常量的介绍
- 《Python基础》实验三指导书(1).doc
- TensorFlow 深度学习、机器学习-任何能够用计算流图形来表达的计算,都可以使用TensorFlow
- 2024最新学成在线网页实战项目代码
- 一个基于springboot+sureness的面向REST API资源无状态认证权限管理系统
- 王博外文文献.pdf
- python毕业设计基于社区检测的多任务聚类联邦学习项目源码+使用说明(高分项目).zip
- Javaweb项目源码-编程爱好者博客地带.zip
- java各个技术栈相关知识点
- PYthon代码 pdf合并
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0