Trying to save the outputs of a for loop
Show older comments
Hi, i am trying to save the different values of the for loop for sigmar1_1 so that i can then plot it. The problem is that i am getting the following error:
'Unable to perform assignment because the indices on the left side are not compatible with the size of the right
side.'
My understanding is that its from the way im creating my zeros array. Thanks in advance for the help.
ri=20;
ro=60;
i=0.03;
E=200000;
v=0.3;
R1=58;
syms p
%e=zeros();
for r=20:40
b1_1=ri^2;
a1_1=(1-b1_1/r^2);
b2_1=ro^2;
a2_1=(1-b2_1/r^2);
A1=(a1_1^-1)-p;
B1=A1*ri^2;
sigmar1=A1*(1-b1_1/r^2);
sigmat1=A1*(1+b1_1/r^2);
inter1_1=sigmat1-v*sigmar1;
inter1=inter1_1/E*r;
A2=(a2_1^-1)-p;
B2=A2*ro^2;
sigmar2=A2*(1-b2_1/r^2);
sigmat2=A2*(1+b2_1/r^2);
inter2_1=sigmat2-v*sigmar2;
inter2=inter2_1/E*r;
eqn=inter1+inter2==i
S=solve(eqn,p)
A1_2=(a1_1^-1)-S;
A2_2=(a2_1^-1)-S;
sigmar1_1=A1_2*(1-b1_1/r^2);
e=zeros(length(sigmar1_1));
e(r)=sigmar1_1
end
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!