Sound travels through air as a result of collisions between

Sound travels through air as a result of collisions between the molecules in the air. The temperature of the air affects the speed of the molecules, which in turn affects the speed of sound. The velocity of sound in dry air can be approximated by the formula: Velocity = 331.3 +0.61 *Tc Where Tc is the temperature of the air in degree s Celsius & the velocity is in meters/seconds. Write a function that takes temperature as an argument and calculates the velocity by using above equation.

Solution

a.

function vel= myfun(Tc)
         vel= 331.3+0.61*Tc  
end

b.

velocity(32)

ans =

350.8200

c.

function vel= myfun(i,f)
fprintf(\'temprature\\tvelocity\');

for Tc=i:f       
vel= 331.3+0.61*Tc;
fprintf(\'\ %f\\t%f\',Tc,vel);
end
end

temprature   velocity
0.000000   331.300000
1.000000   331.910000
2.000000   332.520000
3.000000   333.130000
4.000000   333.740000
5.000000   334.350000
6.000000   334.960000
7.000000   335.570000
8.000000   336.180000
9.000000   336.790000
10.000000   337.400000
11.000000   338.010000
12.000000   338.620000
13.000000   339.230000
14.000000   339.840000
15.000000   340.450000
16.000000   341.060000
17.000000   341.670000
18.000000   342.280000
19.000000   342.890000
20.000000   343.500000
21.000000   344.110000
22.000000   344.720000
23.000000   345.330000
24.000000   345.940000
25.000000   346.550000
26.000000   347.160000
27.000000   347.770000
28.000000   348.380000
29.000000   348.990000
30.000000   349.600000
31.000000   350.210000
32.000000   350.820000
33.000000   351.430000
34.000000   352.040000
35.000000   352.650000
36.000000   353.260000
37.000000   353.870000
38.000000   354.480000
39.000000   355.090000
40.000000   355.700000
41.000000   356.310000
42.000000   356.920000
43.000000   357.530000
44.000000   358.140000
45.000000   358.750000
46.000000   359.360000
47.000000   359.970000
48.000000   360.580000
49.000000   361.190000
50.000000   361.800000


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site