How to use double loop in an equation?

조회 수: 1 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2021년 5월 19일
댓글: Nisar Ahmed 2021년 5월 26일
Hi,
I want to compute a function say Rp as of theta and frequency, like Rp(theta, f).
How can I write equation with double loop and secondly how can I plot it like as a function of theta and f ?

채택된 답변

Jan
Jan 2021년 5월 20일
The readers cannot guess, why you assume, that loops are required. Maybe this is sufficient already:
theta = linspace(0, 180, 20);
f = linspace(1, 10, 20);
y = Rp(theta, f);
surf(theta, f, y)
function y = Rp(theta, f)
y = sin(theta).' .* cos(f / 5);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by