raaj kumar wrote:
> hey guys i have a problem , i wanna draw a graph with many lines
> representing diff pressures but i just end up getting straight lines
> along the same points!
> program:
>
> function [r] = edi(n, p)
> %program t calculate protein release
> %constants
> Kp=4.1399e8;
> a=2.8;
>
> %operation conditions
> N=5
> P=500
>
> %Protein release
> r=(11/exp(Kp*(P^a)*N));
First, you have 'p' as the dummy argument but use 'P' in the function
ML is casesensitive so p doesn't matter internally.
Further, if P is supposed to be p, then the line
P=500 would overwrite the passed value anyway. If that is to be the
same, then remove that assignment completely and either use lower case
or upper case "p" consistently throughout.
You have the same problem w/ the variables "n" and "N"
After that, there doesn't seem any reason to not vectorize the function
at least on the n
r=(11/exp(Kp*(p^a).*N));
...
Then the other could be rewritten as sotoo...
P = [650:50:550]; %
n = [0:7];
r = zeros(length(p),length(n)); % preallocate
for idx=1:length(P)
r(idx,:) = edi(n, P(idx))
end
> plot(n, r(1,:),'ro')
> hold on
> plot (n, r(2,:), 'b*')
> hold on,
> plot (n, r(3,:),'g:')
Untested, but at least a start...

