working with two variables
Ältere Kommentare anzeigen
working with two variables i'm not sure if this is possible, but is it possible to make a 3D plot using an equation based on two variables?
here's my script: -
r_dir=5 %Distance of direct sound path (m)
r_a=0.15 %Radius of rotating drum (m)
d_dir=-5 %Position of centre of rotating drum (on axis) (m)
l_dir=0 %Position of centre of rotating drum off axis/90 degrees from the axis - in the same plane as the rotating drum width ways
t=[0.05] %Time (s)
r_d=5 %Direct distance between receiver and centre of rotating drum (m)
f_r=5 %Frequency/Rotations per second of rotating drum (Hz)
w_r=2*pi*f_r %Angular frequency of the rotating drum
l_f=r_a*sin(w_r*t) %Position of opening on the rotating drum - on the l axis (90 degrees to the axis, so 'off' axis) (m)
d_f=r_a*cos(w_r*t) %Position of opening on the rotating drum - on the d axis (on axis) (m)
r_pd=sqrt((l_f-l_dir).^2+(d_f-d_dir).^2) %Path difference between direct sound path distance and the diffracted sound path distance (m)
r_f=r_a+r_pd %Diffracted sound path distance (m)
c=350 %Speed of sound at 28 degrees celcius with 90% relative humidity
t_y=(r_f-r_dir)/c %Time delay between the arrival of the direct sound and the diffracted sound (sec)
f=20:5:20000 %Frequency of sound from 20 Hz to 20 kHz
w=2*pi*f; %Angular frequency of the sound
AR=r_dir./r_f %Amplitued Ratio - Pressure amplitude of the direct sound divided by the pressure amplitude of the diffracted sound (same as diffracted sound path distance divided by direct sound path distance in metres)
MF=sqrt(AR.^2+1+AR*2*cos(t_y*w))
plot(f,MF)
I picked t=0.05 sec as a constant in the above example, but I'd like to have it so that is a variable too - hence leading to some kind of graph with three dimensions. It would then be a 3D graph (surface) - one axis for the result, one for frequency of sound and one for time.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simultaneous and Synchronized Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!