MATLAB Answers

Undefined Function or Variable

4 views (last 30 days)
Hi, can anyone see why I am getting the error message '''Undefined Function or Variable R'' . As far as I understand I had already defined R...
Many thanks!
gamma = 15; % Unit weight, Kg/m^3
colRadius = 0.17; % Column Radiu, m
theta = 1*(180/pi); % Angle of failure to the horizaontal surface
phi = 15*(180/pi); % Angle of internal friction
depth = zeros(14,2); % Depth, m
for i = 1:19
depth(i,1)=i;
depth(i,2)=2.25+(0.5*i);
p(i,1) = gamma*depth(i,2)*((depth(i,2)/colRadius)^2+(3*(depth(i,2)/colRadius)*tan(theta))+(3*tan(theta)*tan(theta)))/(3*tan(theta)*tan(theta))*(1+(2*(1-sin(phi)*cos((180*(180/pi))-(theta+phi))))/(cos(phi*cos(theta))));
end
gamma = 15; % Unit weight, Kg/m^3
colRadius = 0.17; % Column Radiu, m
theta = 1*(180/pi); % Angle of failure to the horizaontal surface
phi = 15*(180/pi); % Angle of internal friction
E = 2 ; % Modulus of soil deformation, Kpa
n = 1; % Exponant in empirical equation
p = (200); % Applied pressure at the grout soil interface, kPa
c = 5% cohesion
Ri = 0.06; % Drill radius
Ir = 5 % Rigidity index of soil
v = 2 % Poisson's ratio
q = 2 % Initial Isotropic Ground Stress
a1 = ((1/Ir)-1+1*(-(1+v/2*E))*(4*sin(p)/3-sin(phi))*(q+c*cot(phi)))^3;
a2 = c*cot(phi);
a3 = (3*(1+sin(phi))/(3-sin(phi))*(q+c*cot(phi)));
a4 = (3*(1-sin(phi)))/(4*sin(phi));
a5 = (1/Ir);
try
R = (Ri/(a1(p+a2/a3)^a4)+(a3/p+a2)^a4)-a5^(1/3);
catch
end
figure;
hold on
plot(p,R)
xlabel('Injection Pressure (KPa)');
ylabel('Bulb Radius (kPa)');
MATLAB Question.png

  0 Comments

Sign in to comment.

Accepted Answer

Dimitris Kalogiros
Dimitris Kalogiros on 3 Oct 2019
Edited: Dimitris Kalogiros on 3 Oct 2019
I think there is a typo at the formula that calculates R :
Something is missing there. Maybe a + or * mark
By the way, calculation of R gives an error. Since you have enclose it inside "try-catch" , there is no variable R when the script is trying to plot it.
Correct the typo, remove try-catch and try again....

  1 Comment

James Leak
James Leak on 3 Oct 2019
Thank you, I had not noticed that I had missed a *.
Kind regards,
James

Sign in to comment.

More Answers (1)

meghannmarie
meghannmarie on 3 Oct 2019
Edited: meghannmarie on 3 Oct 2019
You are not setting R becuase you have it in a try catch block and it is throwing an error. That is because you are tryind to index a1, but are you really wanting to multiply a1?
Should:
R = (Ri/(al(p+a2/a3)^a4)+(a3/p+a2)^a4)-a5^(1/3)
actually be:
R = (Ri/(al*(p+a2/a3)^a4)+(a3/p+a2)^a4)-a5^1/3

  2 Comments

Steven Lord
Steven Lord on 3 Oct 2019
meghanmarie had flagged this answer:
Flagged by meghannmarie about 1 hour ago.
It marked my answer as spam and it is not
I had marked the answer not spam and I am removing the flag.
James Leak
James Leak on 3 Oct 2019
Thank you very much! this sorted it out perfectly.
Kind regards,
James

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by