실행할 입력 인수가 추가적으로 필요합니다. 무엇을 넣어야 하나요? Additional input arguments are required to run. What should I put in?

6 visualizaciones (últimos 30 días)
재은
재은 el 29 de Nov. de 2022
Respondida: Mohsen Aleenejad el 21 de Dic. de 2022
function x = key2note(A, keynum, dur, fs)
tt = 0:(1/fs):dur-1/fs;
freq = 440 * 2^((keynum-49)/12);
x = A*cos(2*pi*freq*tt - pi/2);
...
위 코드를 실행하려고 하는데, 실행할 입력 인수가 추가적으로 필요하다고 합니다.
어떠한 값을 넣어야 하는 건가요?
I'm trying to execute the above code, but they need an additional input argument to execute.
What kind of value should I put in?

Respuestas (1)

Mohsen Aleenejad
Mohsen Aleenejad el 21 de Dic. de 2022
Hi,
When you run the MATLAB script with:
function x = key2note(A, keynum, dur, fs)
tt = 0:(1/fs):dur-1/fs;
freq = 440 * 2^((keynum-49)/12);
x = A*cos(2*pi*freq*tt - pi/2);
You actually are creating a MATLAB function. You save it, so you can run it later and see the output. For that, you are gonna need to set some inputs, something like this:
if I have these values: A=1, keynum=50, dur=1, and fs is 1000, then I can run this command in MATLAB window for that:
>> key2note(1,50,1,1000)
Then it retuens the corresponding answer for me.

Categorías

Más información sobre 프로그래밍 en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!