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 个评论
Torsten
2022-9-14
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);
Kervin Aranzado
2022-9-14
Torsten
2022-9-14
See my answer above.
Kervin Aranzado
2022-9-14
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.
Kervin Aranzado
2022-9-14
Kervin Aranzado
2022-9-14
Walter Roberson
2022-9-14
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 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


