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

8 ビュー (過去 30 日間)
재은
재은 2022 年 11 月 29 日
回答済み: Mohsen Aleenejad 2022 年 12 月 21 日
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?

回答 (1 件)

Mohsen Aleenejad
Mohsen Aleenejad 2022 年 12 月 21 日
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.

カテゴリ

Help Center および File Exchange프로그래밍 についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!