Integration for a range of values with variable limits
Show older comments
Hi all,
I need to solve the following equation for each individual value of f where f=0:0.01:10:

The equation is for MSAR in the code below, with the intention of getting a range of RMSAR values for a given f.
K1=274350; C1=11040; K2=414000; C2=16000;
M=13200; L1=2.34; L2=2.885; K=2.310;
I=M*(K^2);
a1=46.85*(10^-4); b1=0.19;
syms f
w=f*2*pi;
B11=K1+K2-M*(w^2)+1i*w*(C1+C2);
B12=K2*L2-K1*L1+1i*w*(-C1*L1+C2*L2);
B13=-K1-1i*w*C1;
B21=K2*L2-K1*L1+1i*w*(-C1*L1+C2*L2);
B22=K1*(L1^2)+K2*(L2^2)-I*(w^2)+1i*w*(C1*L1^2+C2*L2^2);
B23=K1*L1+1i*w*C1*L1;
B31=0; B32=0; B33=1;
S1=K2+1i*w*C2;
S2=K2*L2+1i*w*C2*L2;
S3=0.975;
B(1,1)=B11; B(1,2)=B12; B(1,3)=B13;
B(2,1)=B21; B(2,2)=B22; B(2,3)=B23;
B(3,1)=B31; B(3,2)=B32; B(3,3)=B33;
S(1,1)=S1; S(2,1)=S2; S(3,1)=S3;
T=B\S;
hif=T(1,:)';
G1=a1*exp((-b1)*f);
MSARn=@(f)((abs(hif))^2).^(f^4)*G1;
iMSARn=int(MSARn,0.89*f,1.12*f);
MSAR=((2*pi)^4)*iMSARn;
RMSAR=MSAR.^0.5;
When I try running the code, it's incredibly slow. I left it going over night and it still wasn't done. So I need a more practical method as this is only a section of a larger code. Am I correct in thinking that only 'int' accepts variable integral limits? I've tried 'quad' in a loop but it still sees the limits as non-scalar:
for k=1:1:1001;
f(k)=(k-1)/100;
iMSARn(k)=quad(@PSD_Opt_int_loop,[0.89*f(k),1.21*f(k)]);
end
Thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers 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!
