Effacer les filtres
Effacer les filtres

Cannot execute Figure(3).

1 vue (au cours des 30 derniers jours)
N/A
N/A le 29 Sep 2022
Hello,
Was doing my assignments and have managed to solve all except last one, where, I couldn't execute Figure(3) to plot the graph in mathlab.
Here's my code so far. (please see Figure(3) code if there's anything wrong)
k=0.000124; %mass transfer coefficient
d=0.00057; %diameter of the membrane tube
Q=3.4*10.^-8; %flow rate of water
z=linspace(0,0.5); %distance along the length of membrane tube
y=1-exp(-(((k*pi*d)/Q))*z); %Given Equation. Let y be (C/Cr)
figure(1); %Question 3a
plot(z,y);
xlabel('Distance')
ylabel('Concentration')
grid on;
%----------------------------%
%To study the effect of diameter of membrane%
D=[0.0004275;0.00057;0.0007125]; %Calculate manually on 0.75d, d, 1.25d;
Y=1-exp(-(((k*pi*D)/Q))*z); %Given Equation. Let Y be C/Cr to study the diameter of the membrane
figure(2); %effect of diameter of the membrane
plot(z,Y);
xlabel('Distance')
ylabel('Concentration')
legend('0.75d','d','1.25d')
grid on;
%------------------------------------%
%Effect on flow rate%
q=[0.000000025;0.000000034;0.000000042]; %Calculate manually on 0.75Q, Q, 1.25Q;
f=1-exp(-(((k*pi*d)/q))*z);
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To operate on each element of the matrix
individually, use TIMES (.*) for elementwise multiplication.
figure(3); %effect of flow rate
plot(z,f);
xlabel('Distance')
ylabel('Concentration')
legend('0.75Q','Q','1.25Q')
grid on;
Thank you and appreciate your help! :)
  1 commentaire
Rik
Rik le 29 Sep 2022
Did you try following the advice in the error message?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 29 Sep 2022
q=[0.000000025;0.000000034;0.000000042]; %Calculate manually on 0.75Q, Q, 1.25Q;
f=1-exp(-(((k*pi*d)/q))*z);
The / operator is not division and the * operator is not multiplication. The * and / operators are matrix operations, inner product for * and matrix division for /
You need to use .* and ./ instead

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by