# 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 views (last 30 days)
Srivatsa Dasa on 1 Apr 2022
Answered: Chandra on 4 Apr 2022
clc; clear;
syms m;
syms n;
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

Chandra on 4 Apr 2022
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
>>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);

### Categories

Find more on Signal Attributes and Indexing in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by