Check for incorrect argument data type or missing argument in call to function 'sin'.
Mostra commenti meno recenti
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 Commenti
Torsten
il 14 Set 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
il 14 Set 2022
Torsten
il 14 Set 2022
See my answer above.
Kervin Aranzado
il 14 Set 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
il 14 Set 2022
Kervin Aranzado
il 14 Set 2022
Walter Roberson
il 14 Set 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.
Risposte (0)
Categorie
Scopri di più su Measurements and Feature Extraction in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


