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

8 visualizzazioni (ultimi 30 giorni)
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?

Risposte (1)

Mohsen Aleenejad
Mohsen Aleenejad il 21 Dic 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.

Categorie

Scopri di più su 프로그래밍 in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!