Need help on using trapz on a definite integral

3 次查看(过去 30 天)
meu = 0.01; % acting friction during rolling
Radius_R = 21; % Radious of the roll die
kfm= Kfm(1:end,:); % kfm values for all passes
h_1 = h1(1:end,:); % height after reduction
h_0 = h0(1:end,:); % initial height
Delta_h = abs(h_1 - h_0); % relative height reduction
l_d = sqrt(Radius_R*Delta_h); % bite length
initX1 = 0; % bite angle at initial position
Xf = (tspan(rowOfMinValue))'; % bite angle at position Xf 1x201
Lenxf = length(Xf);
X_ld= l_d(1,1); % 1x1 element of xf
SigNach = y(:,1); % 11953x1 back tension
SigVOR = SigV; % 11953x201 front tension
for i = 1:Lenxf
%vRange for the first integration
R1 = initX1 : Xf(i,1);
% for the first integration the constant value is
int1 = SigNach -kfm(1,1);
% Range for the 2nd integration
R2 = Xf(i,1) :X_ld;
% constant for the second integration constant value is
int2 = SigVOR -kfm(1,1);
% first integration
Nach = trapz(R1,int1);
% second integration
Vor = trapz(R2,int1);
%
Final = Nach + Vor;
end
\\\ First of there is something wrong with dimentions in my code (i am beginner). i want to store the {Final = Nach + Vor;} for every values of x_f in a column.\\\\\

回答(1 个)

Alan Stevens
Alan Stevens 2021-7-4
Replace
Final = Nach + Vor;
by
Final(i) = Nach + Vor;
  6 个评论
Alan Stevens
Alan Stevens 2021-7-5
What does this mean:
Xf = (tspan(rowOfMinValue))';
What is rowOfMinValue? Have you defined a function called tspan?
What is y in:
SigNach = y(:,1);
Even when I loaded your data into memory these problems arose! I'm still nowhere near getting to the point of identifying a trapz problem!
You could help us help you by making it easier to run your program. Get it to load the (reduced amount of) data with the appropriate variable names first and then upload the whole program.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by