I keep getting the error using '/'.

"Error using /
Arguments must be numeric, char, or logical. "
I have a 64X1 matrix of vol_frac and particle_ratio each. 'c' goes from 1 to 64 using for loop. Please tell me what is going wrong and how to rectify it. I have tried writing "vf=vol_frac(c,1);" inside for loop so that vf isn't a matrix but still same problem.
mu_ratio=(1-(vol_frac(c,1)/0.605)*((particle_ratio(c,1))^1.2))^(-1.5125);

2 Kommentare

Rik
Rik am 8 Mär. 2024
Try to make a MWE so we can run your code without any other dependencies and can reproduce your issue. The best way to do this is to use the code section in the editor and use the run button. That way you can make sure we will see the same error message as you do.
Adwait Mahajan
Adwait Mahajan am 8 Mär. 2024
The equation is under For loop so need to extract single value from vol_frac matrix. Don't want matrix division.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Alan Stevens
Alan Stevens am 8 Mär. 2024

0 Stimmen

Try
mu_ratio=(1-(vol_frac(c,1)/0.605).*((particle_ratio(c,1)).^1.2)).^(-1.5125);
Notice the dots! .* .^
Difficult to be certain though. You should upload enough program for us to test.

3 Kommentare

Here is the code part of the code that might give you some insight. Also, the dots suggestion didn't work.
clc;
condition=zeros(64,3);
condition=readtable('cases.xlsx','Sheet',1,'Range','A2:C65');
c_limit=64;
results=zeros(c_limit,3);
er=condition(:,1);
vol_frac=condition(:,2);
particle_ratio=condition(:,3);
for c=1:c_limit
%node size, designed for even m,n values
m=158; %circumferencial direction
n=51; %axial direction
%matrices initialization
p=zeros(m,n);
h=zeros(m,n);
h1=zeros(m,n);
A=zeros(m,n);
B=zeros(m,n);
C=zeros(m,n);
D=zeros(m,n);
E=zeros(m,n);
du_dz=zeros(m,n);
shear=zeros(m,n);
q_x=zeros(m,n);
q_y=zeros(m,n);
%bearing specifications
cr=0.0001;
lbyd=1;
d=0.05;
r=d/2;
l=d;
x=zeros(m,n);
y=zeros(m,n);
theta=zeros(m,n);
N=1000; %rpm
omega=(2*pi*N)/60; %rad/s
u=(r-cr)*omega;
delx=(pi*d)/(m-1);
dely=l/(n-1);
den=(delx^2)+(dely^2);
%viscocity
mu_bf=0.027424;
mu_ratio=(1-(vol_frac(c,1)/0.605).*((particle_ratio(c,1)).^1.2)).^(-1.5125);
mu=mu_ratio*mu_bf;
Adwait Mahajan
Adwait Mahajan am 8 Mär. 2024
Not the whole code.

Melden Sie sich an, um zu kommentieren.

VBBV
VBBV am 8 Mär. 2024

0 Stimmen

condition=readmatrix('cases.xlsx','Sheet',1,'Range','A2:C65');

2 Kommentare

VBBV
VBBV am 8 Mär. 2024
use readmatrix function in place of readtable and run the code. The outputs from readtable are usually not numeric arrays
Adwait Mahajan
Adwait Mahajan am 8 Mär. 2024
thanks.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2023a

Gefragt:

am 8 Mär. 2024

Kommentiert:

am 8 Mär. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by