Undefined Function or Variable

2 ビュー (過去 30 日間)
James Leak
James Leak 2019 年 10 月 3 日
コメント済み: James Leak 2019 年 10 月 3 日
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

採用された回答

Dimitris Kalogiros
Dimitris Kalogiros 2019 年 10 月 3 日
編集済み: Dimitris Kalogiros 2019 年 10 月 3 日
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 件のコメント
James Leak
James Leak 2019 年 10 月 3 日
Thank you, I had not noticed that I had missed a *.
Kind regards,
James

サインインしてコメントする。

その他の回答 (1 件)

meghannmarie
meghannmarie 2019 年 10 月 3 日
編集済み: meghannmarie 2019 年 10 月 3 日
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 件のコメント
Steven Lord
Steven Lord 2019 年 10 月 3 日
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 2019 年 10 月 3 日
Thank you very much! this sorted it out perfectly.
Kind regards,
James

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by