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

13 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 행렬과 배열 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!