Check for incorrect argument data type or missing argument in call to function 'sin'.

I'm simulating modulation of my audio signal into a carrier wave.
clc
clear all;
close all;
%Audio
ADS = audioDatastore("AUDIO.wav");
info = audioinfo('AUDIO.wav');
[y,Fs] = audioread('AUDIO.wav');
sound(y,Fs)
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
%Carrier Wave
Fc = 400000;
Ca = 100;
Cs = Ca*sin(2*pi*Fc*t);
%Amplitude Modulation
x = modulate(y,Cs,Fs);
%Plot
subplot(3,1,1);
plot(t,y)
xlabel('Time')
ylabel('Audio Signal')
subplot(3,1,2);
plot([y,Fs]);
title('Carrier');
ylabel('Amplitude');
subplot(3,1,3);
plot(x);
title('Modulated Amplitude');
ylabel('Amplitude');

댓글 수: 9

After the line
t = t(1:end-1);
include the lines
size(t)
class(t)
What information does MATLAB print ?
The class of t is "duration". This is not accepted by the sin-function.
Use
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
t = seconds(t);
instead of
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
I still get the same message " Check for incorrect argument data type or missing argument in call to function 'sin'. "
clc
clear all;
close all;
%Audio
ADS = audioDatastore("AUDIO.wav");
info = audioinfo('AUDIO.wav');
[y,Fs] = audioread('AUDIO.wav');
sound(y,Fs)
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
size(t)
class(t)
%Carrier Wave
Fc = 400000;
Ca = 100;
Cs = Ca*sin(2*pi*Fc*t);
%Amplitude Modulation
x = modulate(y,Cs,Fs);
%Plot
subplot(3,1,1);
plot(t,y)
xlabel('Time')
ylabel('Audio Signal')
subplot(3,1,2);
plot([y,Fs]);
title('Carrier');
ylabel('Amplitude');
subplot(3,1,3);
plot(x);
title('Modulated Amplitude');
ylabel('Amplitude');
The result
clc;
clear all;
close all;
%Audio
ADS = audioDatastore("AUDIO.wav");
info = audioinfo('AUDIO.wav');
[y,Fs] = audioread('AUDIO.wav');
sound(y,Fs);
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
t = seconds(t);
size(t)
class(t)
%Carrier Wave
Fc = 400000;
Ca = 100;
Cs = Ca*sin(2*pi*Fc*t);
%Amplitude Modulation
x = modulate(y,Cs,Fs);
%Plot
subplot(3,1,1);
plot(t,y);
xlabel('Time')
ylabel('Audio Signal')
subplot(3,1,2);
plot([y,Fs]);
title('Carrier')
ylabel('Amplitude')
subplot(3,1,3);
plot(x);
title('Modulated Amplitude')
ylabel('Amplitude')
The command
plot([y,Fs])
does not make sense.
Read again what the outputs from "audioread" mean.
y is a vector, Fs is a scalar value.
Code Check:
clc;
clear all;
close all;
%Audio
ADS = audioDatastore("AUDIO.wav");
info = audioinfo('AUDIO.wav');
[y,Fs] = audioread('AUDIO.wav');
sound(y,Fs);
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
t = seconds(t);
size(t)
class(t)
%Carrier Wave
Fc = 22000;
Ca = 100;
Cs = Ca*sin(2*pi*Fc*t);
%Amplitude Modulation
x = modulate(y,Cs,Fs);
%Plot
subplot(3,1,1);
plot(t,y);
xlabel('Time')
ylabel('Audio Signal')
subplot(3,1,2);
plot(y,Fs);
title('Signal')
ylabel('Amplitude')
subplot(3,1,3);
plot(x);
title('Modulated Amplitude')
ylabel('Amplitude')
Is there a problem with the signal plotting or it's just it?
Fs is your sampling frequency for the audio. It does not change over time. And you are using your -1 to +1 audio signal as your independent variable for the plot.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

태그

질문:

2022년 9월 14일

댓글:

2022년 9월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by