Syntax problem with a user-defined function with sine

์กฐํšŒ ์ˆ˜: 3 (์ตœ๊ทผ 30์ผ)
Mhyanif
Mhyanif 2023๋…„ 3์›” 3์ผ
ํŽธ์ง‘: KSSV 2023๋…„ 3์›” 3์ผ
Hello, I need to make this function r(๐œƒ) = ๐œ‹(3โ€•sin^5*๐œƒ) as a user-defined function, but I keep getting the "Error using sin - Not enough input arguments." This is how I defined the function so far:
r(theta)=my_function(pi(3-sin.^5*theta));
How do I fix it?

๋‹ต๋ณ€ (1๊ฐœ)

KSSV
KSSV 2023๋…„ 3์›” 3์ผ
ํŽธ์ง‘: KSSV 2023๋…„ 3์›” 3์ผ
function r = my_function(thet)
r = pi*(3-sin(theta)^5) ;
end
Save the above, it will be saved on he name my_function.m. Or copy it under your main function code.
You can also define anonymous function as shown below:
r = @(theta) pi*(3-sin(theta)^5) ;
r(pi/2)
Note: your theta shoould be in radians. If you want theta in degrees either convert it to radians or use sind

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Logical์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์ œํ’ˆ


๋ฆด๋ฆฌ์Šค

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by