NEED ANSWERS IN NUMERICAL FORM

1 view (last 30 days)
Cassi
Cassi on 5 Mar 2013
% Strain gauge Calculator
clc
a= input('Enter First Strain Gauge readings');
b= input('Enter Second Strain Gauge readings');
c= input('Enter Third Strain Gauge readings');
theta2 = input('Enter Angle Between A and B');
theta3 = input('Enter Angle Between B and C');
theta1=0;
i=0.5*(1+cos(0.0174*2*theta1));
j=0.5*(1-cos(0.0174*2*theta1));
k=0.5*sin(0.0174*2*theta1);
l=0.5*(1+cos(0.0174*2*theta2));
m=0.5*(1-cos(0.0174*2*theta2));
n=0.5*sin(0.0174*2*theta2);
o=0.5*(1+cos(0.0174*2*theta3));
p=0.5*(1-cos(0.0174*2*theta3));
q=0.5*sin(0.0174*2*theta3);
[x, y, z] = solve('i*x + j*y + k*z = a', 'l*x + m*y + n*z = b','o*x + p*y + q*z = c', 'x', 'y', 'z');
A=0.5*(x+y);
B=(x-y)^2+z^2;
s1=A+0.5*sqrt(B);
s2=A-0.5*sqrt(B);
theta=0.5*atan(z/(x-y));
disp(s1)
disp(s2)
disp(theta)

Answers (1)

Carlos
Carlos on 5 Mar 2013
Try this:
>> a= input('Enter First Strain Gauge readings');
b= input('Enter Second Strain Gauge readings');
c= input('Enter Third Strain Gauge readings');
theta2 = input('Enter Angle Between A and B');
theta3 = input('Enter Angle Between B and C');
theta1=0;
i=0.5*(1+cos(0.0174*2*theta1));
j=0.5*(1-cos(0.0174*2*theta1));
k=0.5*sin(0.0174*2*theta1);
l=0.5*(1+cos(0.0174*2*theta2));
m=0.5*(1-cos(0.0174*2*theta2));
n=0.5*sin(0.0174*2*theta2);
o=0.5*(1+cos(0.0174*2*theta3));
p=0.5*(1-cos(0.0174*2*theta3));
q=0.5*sin(0.0174*2*theta3);
Enter First Strain Gauge readings 32
Enter Second Strain Gauge readings 43
Enter Third Strain Gauge readings 4
Enter Angle Between A and B 42
Enter Angle Between B and C 45
>> a1=i*x + j*y + k*z -a;
>> syms x y z;
>> a1=i*x + j*y + k*z -a;
>> a2=l*x + m*y + n*z -b;
>> a3=o*x + p*y + q*z -c;
>> [x1, y1, z1] = solve(a1,a2,a3,'x','y','z')
I obtain this answer (remember I have entered random values for the strain gauge readings and angles).
x1 =
32
y1 =
-6045918607341835657578447208438336/7972281774681996275424235458761
z1 =
5824429148451108692498456082010944/7972281774681996275424235458761
If you want your answer in numeric format:
>> eval(y1)
ans =
-758.3674

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!