given a speech signal(.wav) file, we are required to plot cosine waves over it like cos(k1*x),cos(k2*x).I tried using dct function but to unable to proceedd

조회 수: 5 (최근 30일)
clc; clear;
syms m;
syms n;
[x, fs] = audioread('sample.wav');
x = x(:, 1);
xlen = length(x);
subplot(311)
plot(x)
subplot(312)
t=[-xlen:0.01:xlen];
plot(cos(2*pi*t/xlen));
y=dct(x);
y1=y*cos(2*pi/xlen);
y2=idct(y1);
subplot(313)
plot(y2) % i am required to plot cos waves around the .wav file but unable to proceed

답변 (1개)

Chandra
Chandra 2022년 4월 4일
Hi,
By multiplying the cosine signal over the sound signal we can get the required signal
Use the following code to generate the plot
//Matlab code
>>[x, fs] = audioread('sample.wav');
>>t = linspace(0,length(x),length(x)); % or we can use t =0:length(x)-1;
>>n = x'.*cos(2*pi*fs*t);%multiplication is done using dot multiplication, the frequency value
%can be used depending on user values
>>plot(n);

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by