Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 11- Project week 2 - Diffusion

Similar presentations


Presentation on theme: "Week 11- Project week 2 - Diffusion"— Presentation transcript:

1 Week 11- Project week 2 - Diffusion
Today: Project forms Element by element math

2 Element by element math
Remember that MATLAB assumes matrix operations for multiplication and division. Need element by element do use the period”.” declaration before the math operation to declare element by element math

3 Examples of Element by element
function D=diffusionC(T); %Input argument is: %T: temperature in K %Output argumet is: %D: diffusion coefficient m^2/s Do=2.2*10^(-4); Q=29.3*10^3; R=1.987; D=Do*exp(-Q./(R*T)); function D=diffusionC(T); %Input argument is: %T: temperature in K %Output argumet is: %D: diffusion coefficient m^2/s Do=2.2*10^(-4); Q=29.3*10^3; R=1.987; D=Do*exp(-Q/(R*T)); Above function runs, but cannot be linked into a program that requires more than a single D value. Need “.” after Q

4 Plot Diffusion Data % Plot demo first assignment T = 300:1:1000;
D=diffusionC(T); T=(1000./T); Note element by element again with period after 1000. x=T; y=log10(D); plot(x,y,'linewidth',2) xlabel('Temperature (1000/T,K)') ylabel('Diffusivity (m^2/sec)') title('Dr Brown Plot EGR 106 Spring 2008') [xv,yv]=ginput(1) xv=((1./xv)*1000)-273 yv=10^yv gtext (['At a temperature of ',num2str(xv,3),' (^oC), Carbon diffusivity is ',num2str(yv,2),' (m^2/sec)'])

5 Output From “ginput and gtext”


Download ppt "Week 11- Project week 2 - Diffusion"

Similar presentations


Ads by Google