Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Just extra coding that I used over this last year for my classes
- %% Itertive Guess V and Re 409
- % Set up
- % Input Constants
- mu = input('dynamic viscosity\n');
- rho = input('Density \n');
- L = input('Length of Pipe\n');
- D = input('Diameter of Pipe\n');
- alpha = input('Kinetic Energy Correction Factor\n');
- epsilon = input('Roughness epsilon (not e/D)\n');
- % Repeating Inputs
- Re = input('Re guess\n');
- f = input('Friction Factor\n');
- % Constants
- g = 9.81; % [m/s] gravitational constant
- A = (-2.457*log((7/Re)^0.9+0.27*epsilon/D))^16;
- B = (37530/Re)^16;
- %% Loop
- while 1
- Vin = sqrt(2*g*z/(f*L/D+alpha))
- Re = rho*Vin*D/mu
- f = 8*((8/Re)^12+(A+B)^(-1.5))^(1/12)
- Vnew = sqrt(2*g*z/(f*L/D+alpha))
- if(abs((Vin-Vnew)/Vin) < 0.03)
- break;
- end
- Vin = Vnew;
- end
- %% Calculating Vm for transport across a typical cariac muscle cell membrane
- syms Vm R T F CL C0 P1 P2 P3 P4 C1L C2L C3L C4L C10 C20 C30 C40 b
- format compact
- z = [1, 1, -1, 2];
- p = [P1 P2 P3 P4];
- Cl = [C1L C2L C3L C4L];
- Co = [C10 C20 C30 C40];
- for i = 1:4
- N(i) = -p(i)*Vm*z(i)*b*(Cl(i)-Co(i)*exp(-Vm*z(i)*b))/(1-exp(Vm*z(i)*b));
- i = i+1;
- end
- a = N(1)+N(2)+2*N(4)== N(3);
- solve ([a,Vm])
- %% 201 HW 6
- a = 1;
- for a = 1:5
- x = input('x-coordinates\n');
- y = input('y-coordinates\n');
- i = 1;
- j = 2;
- for k = 1:4
- Mag(i) = sqrt( (x(i)-x(j))^2 + (y(i)-y(j))^2 );
- Mag_tot (a,i) = Mag(i);
- i = i+1;
- j = j+1;
- end
- Mean(a) = mean(Mag);
- SD(a) = std(Mag);
- a = a+1;
- end
- %%
- syms x
- p1 = 0.8;
- p2 = 8;
- p3 = 4;
- c10 = 150;
- c1l =12;
- c20 = 4;
- c30 = 120;
- c40 = 100;
- c2l = 140;
- c3l= 4;
- c4l = 20;
- y = 1-exp(-x);
- p1*c1l-p1*c10*y+p2*c2l-p2*c20*y+p3*c30-p3*c3l*y+(c4l-c40*y^2)/(1+y);
- solve([ans])
- %%
- syms t K1 K2 phi
- A = 95;
- Rm = 2;
- R0 = 8;
- Cm = 100;
- Vc = 100+100*sin(1000*t)
- Vm = K1+K2*sin(1000*t+phi)
- K = Rm/(Rm+R0)
- solve([Vm==K*A/(1+K*A)*Vc])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement