سؤال

There seems to be a small problem with my matlabcode. i'm trying to calculate Qx using this simple formula. Anybody has an idea what i'm doing wrong?

Error: File: functie5612.m Line: 2 Column: 28
Unexpected MATLAB expression.

Error in oef5612 (line 2)
Qx=functie5612(D)

Define my function

function Qx=functie5612(D)
Qx= D*(11-(0.1*D)/(0.28-D))0.8
end

Initial parameter

D=[0;2;4;6;8;10;12;14;16;18;20;22;23;24;25;26;27;28;30;32;34;36;38]

Using my function

Qx=functie5612(D)

making a graph

clf
figure(1);
plot(D,Qx);
title ('Optimale dilutiesnelheid','FontSize',12);
xlabel('D(1/h)','FontSize',12);
ylabel('Volumetrische biomassaproductiviteit(kg/(m^3*h)','FontSize',12);
legend('Substraat','Product','Biomassa') `
هل كانت مفيدة؟

المحلول

You need the explicit * when doing multiplication. That is, you should have )*0.8 and not just )0.8. So your function should look like:

function Qx=functie5612(D)
Qx= D*(11-(0.1*D)/(0.28-D))*0.8
end

However, this is still incorrect (dimensions mismatch). If you are looking at elementwise multiplication of D, you will need to use the . operator. The code would look like:

Qx= D.*(11-(0.1*D)./(0.28-D))*0.8

نصائح أخرى

The error you get is due to a matrix dimesion mismatch. So, you need to use the .* operator instead of *

Qx= D.*(11-(0.1.*D)./(0.28-D)).*0.8;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top