- #1
darkxynx
- 4
- 0
Hi I am currently trying to program something that will accept a vector as input for one my function. However, this is my first time programming, and I am relying completely on the internet and the Chapra textbook for help.
This is what I have so far:
%Re=reynolds number
%p = density of the fluid
%v=mean fluid velocity
%D=diameter of the fluid
%u=fluid viscosity
function Re=viscosity(p,v,D,u)
p=input('p: ');
v=input('v: ');
D=input('D: ');
u=input('u: ');
Re=(p*v*D)/u;
if Re<2000
disp('The liquid is laminar')
elseif Re>=2000&Re<=4000
disp('The liquid is transition')
else
disp('The liquid is Turbulent')
end
However, we have to input the a chart of data, running the function only once. I did some researching and I could not find any examples. If anyone could point me in the right direction, I'd really appreciate it. My next attempt would be to somehow use index and for loop.
The chart of data we have is a 3x4.
On a side note, anyone know any good resources for coding with matlab?
Thanks!
This is what I have so far:
%Re=reynolds number
%p = density of the fluid
%v=mean fluid velocity
%D=diameter of the fluid
%u=fluid viscosity
function Re=viscosity(p,v,D,u)
p=input('p: ');
v=input('v: ');
D=input('D: ');
u=input('u: ');
Re=(p*v*D)/u;
if Re<2000
disp('The liquid is laminar')
elseif Re>=2000&Re<=4000
disp('The liquid is transition')
else
disp('The liquid is Turbulent')
end
However, we have to input the a chart of data, running the function only once. I did some researching and I could not find any examples. If anyone could point me in the right direction, I'd really appreciate it. My next attempt would be to somehow use index and for loop.
The chart of data we have is a 3x4.
On a side note, anyone know any good resources for coding with matlab?
Thanks!