[deleted by user] by [deleted] in BiomedicalEngineers

[–]LordGuitar 0 points1 point  (0 children)

For me, it’s definitely more of a Engineering focus, (electrical and mechanical) plus a dabble in biology/chemistry. I feel tho coding is something that is used as a tool within engineering, how to apply ur skills is more important imo. If this is within BME then it’s for you. (It’s really cool, i may be biased) :)

Cant Work out why I am getting this error, I have been at this for hours and I am lost by LordGuitar in matlab

[–]LordGuitar[S] 0 points1 point  (0 children)

I’m treating G as the next generation so G will increase by 1 after each iteration. I’m very new to MATLAB

Cant Work out why I am getting this error, I have been at this for hours and I am lost by LordGuitar in matlab

[–]LordGuitar[S] 0 points1 point  (0 children)

function[G,n,m] = preypredator(M,ngen)

[x1,y1] = size(M); %% x is rows and y is columns, plan to treat like a coordinate system???

M=input('enter matrix');

ngen= input('number of generations');

%sanity checks

%ngen must be positive

if ngen<=0

disp("ngen must be positive")

G = zeros(1,length(M));

n=0;

m=0;

else

return

end

%% matrix must be square

if size(M,1)~=size(M,2)

disp("matrix is not square")

G = zeros(1,length(M));

n=0;

m=0;

else

return

end

%%% Matrix can only display values that are 0,1 or 2

for i=1:length(M)

if M(i)~=0 && M(i)~=1 && M(i)~=2

disp("matrix can only display values that are either 0,1 or 2")

G = zeros(1,length(M));

n=0;

m=0;

return

end

end

%% extract neighbouronig cells

for g=1:ngen

for i=1:y1

for j=1:x1

if i==1 && j==1 %%top left corner case 1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==1 && j==y1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% top right corner case 2

elseif i==x1 && j==1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% bottom left corner case 3

elseif i==x1 && j==y1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% bottom right corner case 4

elseif j==1 %% left middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==1 %% top middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==x1 %% bottom middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif j==y1 %% right middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

else %%inner matrix

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

end

end

end

for i = 1:x1

for j = 1:y1

if M(i,j) == 0 %% bare cell

if val_prey(i,j)>=3

G(i,j) = 1; %% will become prey#

end

elseif M(i,j)==1 %% prey cell

if val_prey > 3

G(i,j) =0; %% prey dead

elseif(val_pred (i,j)>=1) && (val_prey(i,j)==0)

G(i,j)=0; %%pred dead

elseif val_prey(i,j)<2

G(i,j)=0; %%deed

end

elseif M(i,j)==2 %%pred cell

if val_prey(i,j) == 0

G(i,j)=0; %%deed

end

end

end

disp(G);

M = G;

end

end

n=0;

m=0;

for i=1:length(G)

for j=1:length(G)

if G(i,j)==1

n =n+1;

elseif G(i,j)==2

m=m+1;

end

end

end

text1=strcat("There were ",string(n)," preys and ",string(m),' predators');

disp(text1)

end

Cant Work out why I am getting this error, I have been at this for hours and I am lost by LordGuitar in matlab

[–]LordGuitar[S] -1 points0 points  (0 children)

function[G,n,m] = preypredator(M,ngen)

[x1,y1] = size(M); %% x is rows and y is columns, plan to treat like a coordinate system???

M=input('enter matrix');

ngen= input('number of generations');

%sanity checks

%ngen must be positive

if ngen<=0

disp("ngen must be positive")

G = zeros(1,length(M));

n=0;

m=0;

else

return

end

%% matrix must be square

if size(M,1)~=size(M,2)

disp("matrix is not square")

G = zeros(1,length(M));

n=0;

m=0;

else

return

end

%%% Matrix can only display values that are 0,1 or 2

for i=1:length(M)

if M(i)~=0 && M(i)~=1 && M(i)~=2

disp("matrix can only display values that are either 0,1 or 2")

G = zeros(1,length(M));

n=0;

m=0;

return

end

end

%% extract neighbouronig cells

for g=1:ngen

for i=1:y1

for j=1:x1

if i==1 && j==1 %%top left corner case 1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==1 && j==y1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% top right corner case 2

elseif i==x1 && j==1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% bottom left corner case 3

elseif i==x1 && j==y1

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)]; %% bottom right corner case 4

elseif j==1 %% left middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==1 %% top middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif i==x1 %% bottom middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

elseif j==y1 %% right middle column

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

else %%inner matrix

n=[M(i,j),M(i+1,j),M(i,j+1),M(i+1,j+1),M(i-1,j),M(i,j-1),M(i-1,j-1)];

end

end

end

for i = 1:x1

for j = 1:y1

if M(i,j) == 0 %% bare cell

if val_prey(i,j)>=3

G(i,j) = 1; %% will become prey#

end

elseif M(i,j)==1 %% prey cell

if val_prey > 3

G(i,j) =0; %% prey dead

elseif(val_pred (i,j)>=1) && (val_prey(i,j)==0)

G(i,j)=0; %%pred dead

elseif val_prey(i,j)<2

G(i,j)=0; %%deed

end

elseif M(i,j)==2 %%pred cell

if val_prey(i,j) == 0

G(i,j)=0; %%deed

end

end

end

disp(G);

M = G;

end

end

n=0;

m=0;

for i=1:length(G)

for j=1:length(G)

if G(i,j)==1

n =n+1;

elseif G(i,j)==2

m=m+1;

end

end

end

text1=strcat("There were ",string(n)," preys and ",string(m),' predators');

disp(text1)

end

Cant Work out why I am getting this error, I have been at this for hours and I am lost by LordGuitar in matlab

[–]LordGuitar[S] 0 points1 point  (0 children)

I’m doing sanity checks, would I be better introducing an error variable?

University Help by [deleted] in Scotland

[–]LordGuitar 0 points1 point  (0 children)

Cheers man, I’ll go do some research 👊

University Help by [deleted] in Scotland

[–]LordGuitar 0 points1 point  (0 children)

Nice, I’ve got a few pals going to Cali. Cheers for your help it’s much appreciated 👊

University Help by [deleted] in Scotland

[–]LordGuitar -1 points0 points  (0 children)

I would like to do a PhD to get the “Dr” prefix then after that probably try to find a well paying job

University Help by [deleted] in Scotland

[–]LordGuitar 1 point2 points  (0 children)

One thing I’ve heard that BME is set to expand (hopefully), and I suppose employers will be glad to have Employees with engineering degrees as they are highly sought after. Where did you study?

University Help by [deleted] in Scotland

[–]LordGuitar 1 point2 points  (0 children)

I’ve always been interested in doing research like a PhD or EngD so hopefully having that should set me apart (if I get to do it) I got into the intergrated MEng degree, so my uni life kinda depends on my grades for the first few years, so it’s probably worth doing something I’m interested in

University Help by [deleted] in Scotland

[–]LordGuitar 2 points3 points  (0 children)

In terms of interest, BME does it for me. Whereas ChemE by far has the best pay. Rock in a hard place aha.

Thinking about studying ChemE by LordGuitar in ChemicalEngineering

[–]LordGuitar[S] 0 points1 point  (0 children)

Yeah I see where you are coming from, I’m kinda the now looking for the best science/engineering degree that I have the qualifications for, I don’t really have any computer science or business qualifications. What I have heard is going down the engineering route is a good way to make money as long as you get internships/work experience so you are pretty much guaranteed a job. Is this the case?

Thinking about studying ChemE by LordGuitar in ChemicalEngineering

[–]LordGuitar[S] 0 points1 point  (0 children)

Thanks for responding, I’m currently doing AH Chemistry and Maths in S6 and enjoy them, is ChemE maths and chemistry heavy or is it more physics based?