필터 지우기
필터 지우기

Cannot execute Figure(3).

조회 수: 1 (최근 30일)
N/A
N/A 2022년 9월 29일
답변: Walter Roberson 2022년 9월 29일
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
Rik
Rik 2022년 9월 29일
Did you try following the advice in the error message?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 9월 29일
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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by