Plotting Sound Pressure Level
Mostra commenti meno recenti
Hi,
So I am trying to plot the eqution:

The final solution should look like what is attached. I constructed it using a loop but I don't think I'm follwoing the right steps.. For some reason it just says R is equal to 1000 and does not give me values between 1 to 1000.
r = 45;
alpha = .005;
W = .01;
Wref = 1*10^-12;
Lw = 10*log(W/Wref)
for R = 1:1000
Lp(R) = Lw-10*log10(2*pi*r^2)-alpha*R;
end
Thanks, anything would help.
Risposte (1)
Image Analyst
il 26 Nov 2018
Modificato: Image Analyst
il 26 Nov 2018
Instead of
for R = 1:1000
Lp(R) = Lw-10*log10(2*pi*r^2)-alpha*R;
end
do it vectorized
alpha = .005;
W = .01;
Wref = 1*10^-12;
Lw = 10*log(W/Wref)
R = 1 : 1000
Lp = Lw - 10*log10(2*pi*R.^2) - alpha*R;
plot(R, Lp, 'b-', 'LineWidth', 2)
grid on;
xlabel('R', 'FontSize', 15);
ylabel('Lw', 'FontSize', 15);
This assumes your formula for Lw is correct.

2 Commenti
Articat
il 9 Gen 2019
Image Analyst
il 10 Gen 2019
Are we done yet? What's still needed for you to "Accept this answer"?
Categorie
Scopri di più su MATLAB Mobile in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!