Nummerical integration
Show older comments
Hello there
I wish to evaluate three numerical integrals. I call a vector (vBL)from another file. Then I want to get a value from each integral for each value in vBL.
I tried symbolic integration, but that didn´t work for large number of n. Now I am trying numerical integration, but this is not working ether.
Anybody knows how to make this work.
Also, in the second integral vK(i) I need to differentiate vm(i) twice, could this give a problem when using numerical integration?
The code
function [vM,vK,vP]=generalized(E,I,L,m,T,n)
%Data E; %E-modul N/m^2 I; %Inertimomentet m^4 m; %ensfordelt masse kg/m L; %Længden m
for t=0:T/100:T;
P=25000; %Lasten
end n;%antal modes
%Kalder BL vektor
vBL=BLC(n);
vB=1/L*vBL;
%Beregning af den generaliseret masse, stivhed og last.
vM=zeros(n,1); vK=zeros(n,1); vP=zeros(n,1);
for i=1:1:n;
vm(i)=@(x) cosh(vB(i)*x)-cos(vB(i)*x)-(cosh(vBL(i))+cos(vBL(i)))/(sinh(vBL(i))+sin(vBL(i)))*(sinh(vB(i)*x)-sin(vB(i)*x));%Modeshape vektor
vM(i)=quad(m*vm(i).^2,0,L);
vK(i)=quad((E*I*diff(vm(i),x,2).^2),0,L);
vP(i)=quad(P*vm(i),0,L);
end
end
Thanks in advance
1 Comment
Jan
on 13 Mar 2012
Please define "didn't work" with any details: too slow, wrong results (what did you expect), error message? Inn addition I suggest to format your code to increase the readability, see the "Markup help" link on this page.
Answers (0)
Categories
Find more on Plot Settings 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!