How to use double loop in an equation?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nisar Ahmed
am 19 Mai 2021
Kommentiert: Nisar Ahmed
am 26 Mai 2021
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 ?
0 Kommentare
Akzeptierte Antwort
Jan
am 20 Mai 2021
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!