Outputting as Column vectors as too many columns
2 views (last 30 days)
Show older comments
I have been receiving 12 columns instead of 4 when I run it. I have tried to run a while loop to only run one value from the column at a time but I have been getting errors. I am not sure how to call specific row and column placements from the vectors. This is my crude attempt at it. I really appreciate your help
R1=119.2; %%Resisters
R4=119.1; %%Resisters
Rpot=120.1; %%Potentiometer
Ro=120.2; %%Strain Gage Resistance Unloaded
Ri=909.0909;
Rf=1000000;
Vs=5; %%Voltage
GF=2.14; %%Gage Factor
E=10.4; %%Modulus of Elasticity Aluminium
Vo1=[0; 1.64; 1.565; 1.606; 1.615; 1.593; 1.648; 1.465; 1.595; 1.545; 1.63; 0;] %%Output voltage Item 1
Vo2=[0; 1.716; 1.56; 1.61; 1.661; 1.682; 1.705; 1.59; 1.64; 1.687; 1.661; 0;] %%Output voltage Item 2
Vo3=[1.667; 1.69; 1.68; 1.705; 1.711; 0; 1.698; 1.62; 1.626; 1.65; 1.687; 0;] %%Output voltage Item 3
Vo4=[1.75; 1.713; 1.635; 1.715; 1.766; 0; 0; 0; 0; 0; 0; 0;] %%Output voltage Item 4
Vbridge=[Vo1 Vo2 Vo3 Vo4]/((1+Rf/Ri)) %%Bridge Voltage Output
y=1
x=1
while x<=12
while y<=12
Rg(x,y)=-((Rpot*(Vbridge(x,y)+Vs)+R1*Vbridge(x,y))/(R4*Vbridge(x,y)+R1*(Vbridge(x,y)-Vs)))
y=y+1
end
x=1
x=x+1
end
0 Comments
Accepted Answer
Walter Roberson
on 5 Nov 2015
I copied and pasted your exact code, and received only one value for Vbridge and only one value for Rg.
I notice that you are not using Vol1, Vol2, Vol3, or Vol4 in your calculations. I also notice that those are vectors of 12 items. You were probably running some calculation involving them.
I suspect that you need to read http://www.mathworks.com/help/matlab/ref/mrdivide.html and http://www.mathworks.com/help/matlab/ref/rdivide.html
1 Comment
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!