NEED ANSWERS IN NUMERICAL FORM

1 次查看(过去 30 天)
Cassi
Cassi 2013-3-5
% 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)

回答(1 个)

Carlos
Carlos 2013-3-5
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

类别

Help CenterFile Exchange 中查找有关 MATLAB Mobile Fundamentals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by