微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > integration in matlab

integration in matlab

时间:04-01 整理:3721RD 点击:
Matlab is giving error in integration of expression like {sin(x)/cosh(x)},how to do it?

Here is some simple code. If you are using this for a school project or something, I would recommend using trapezoidal rule or something more sophisticated. Anyway, this code performs the integration and does not get an error on my computer.

% Define Integration Parameters
N = 1000;
x1 = -10;
x2 = 10;

% Compute Function
x = linspace(x1,x2,N);
f = sin(x)./cosh(x);

% Compute Integral
dx = (x2-x1)/N;
fi = sum(f)*dx;

% Show Results
plot(x,f);
disp(['Integral from x1 to x2 is ' num2str(fi)]);

Hi,thanks for the reply..........but I have solved this problem through Numerical methods by approximating function

give the expression like this

(sin(x)/cosh(x));

How about searching mfun?

上一篇: antenna losses
下一篇:最后一页

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top