Check for incorrect argument data type or missing argument in call to function 'sin'.
Mostrar comentarios más antiguos
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 comentarios
Torsten
el 14 de Sept. de 2022
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
el 14 de Sept. de 2022
Torsten
el 14 de Sept. de 2022
See my answer above.
Kervin Aranzado
el 14 de Sept. de 2022
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
el 14 de Sept. de 2022
Kervin Aranzado
el 14 de Sept. de 2022
Walter Roberson
el 14 de Sept. de 2022
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.
Respuestas (0)
Categorías
Más información sobre Audio I/O and Waveform Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


