How I can collect the results?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello again everyone, I have a super simple question... that I cannot answer myself, I'm trying to collect the results of the calculus I do in this program
function [K]=prac2
clc
clear
tol=0.01;
q=40.185;
pcarga=0.7;
L=5;
l=5/20;
P0b=pcarga*q*(l/2);
P0=pcarga*q*l;
x0=0;
y=0;
E=30000000;
Ib=0.00004;
M=0;
AM21=1;
AP1=0;
AP2=0;
AP3=0;
AP4=0;
AP5=0;
AP6=0;
AP7=0;
AP8=0;
AP9=0;
AP10=0;
AP11=0;
AP12=0;
AP13=0;
AP14=0;
AP15=0;
AP16=0;
AP17=0;
AP18=0;
AP19=0;
AP20=0;
AP21=0;
p(1)=P0b+AP1;
p(2)=P0+AP2;
p(3)=P0+AP3;
p(4)=P0+AP4;
p(5)=P0+AP5;
p(6)=P0+AP6;
p(7)=P0+AP7;
p(8)=P0+AP8;
p(9)=P0+AP9;
p(10)=P0+AP10;
p(11)=P0+AP11;
p(12)=P0+AP12;
p(13)=P0+AP13;
p(14)=P0+AP14;
p(15)=P0+AP15;
p(16)=P0+AP16;
p(17)=P0+AP17;
p(18)=P0+AP18;
p(19)=P0+AP19;
p(20)=P0+AP20;
p(21)=P0b+AP21;
for i=1:21
x(i)=(i*l+x0)-l;
for j=1:21
y(j)=(j*l+x0)-l;
if i>j
%BC
incr=(p(j)*y(j)^2/L^3)*(L*(L-y(j))+L^2-L*x(i)-2*(L-y(j))*x(i));
else
%AC
incr=(p(j)*(L-y(j))^2/L^3)*(L*x(i)+2*y(j)*x(i)-y(j)*L);
end
M(j+1)=M(j)+incr;
end
K(i)=M(j+1)
end
The program works fine but the problem is that it doesn't create a variable with the results, it just make the calculus but doesn't store the results anywhere.
Please give me a hand. THX in advance.
0 Kommentare
Antworten (1)
Zack
am 21 Mai 2013
If you are running this code from the editor, it should create a variable "ans" with the data. It did for me.
Alternatively, you can run the program from the command line:
K = prac2
And now K will be your variable.
3 Kommentare
Iain
am 22 Mai 2013
Two options:
1 - Remove the function call, and EVERYTHING will be available, or:
2 - function [output1_you_want, output2_you_want K] = prac2, where output1_you_want is the variable name you want output.
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!