Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9126703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:06:10+00:00 2026-06-17T07:06:10+00:00

I am facing some problem during calculation of Numerical Integration with two data set.

  • 0

I am facing some problem during calculation of Numerical Integration with two data set.
For integration i am using simpsons 1/3 rule.

    function I = Simpsons(f,a,b,n)
    if numel(f)>1 % If the input provided is a vector
        n=numel(f)-1; h=(b-a)/n;
        I= h/3*(f(1)+2*sum(f(3:2:end-2))+4*sum(f(2:2:end))+f(end));
    else 
        h=(b-a)/n; xi=a:h:b;
        I= h/3*(f(xi(1))+2*sum(f(xi(3:2:end-2)))+4*sum(f(xi(2:2:end)))+f(xi(end)));
    end

This code correctly calculates the integration.

Now the problem occurs during the calculation of multiplied values.

for example I have two functions f and g both are depending on same variable.
the variables is in the same ranges. SO lower Limit and Upper Limit is same.

$\int_a^b \! f(x) *g(x) \, \mathrm{d} x.$

here the resolution of x is different. Means for f(x) we have 1000 data where as for g(x) we have 1700 data points. so element by element multiplication cant be done.

How to Solve this integration ..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:06:12+00:00Added an answer on June 17, 2026 at 7:06 am

    you’ll need to interpolate one of your functions, f or g, to the other function points, for 1D functions that is achievable using interp1.

    For example:

    % x1 an x2 have the same limits but different # of elements
    
     x1 = linspace(-10,10,100); 
     x2 = sort(rand(1,170)*20-10); # non-unifrom points from -10 to 10
    
     f1 = sin(x1);
     f2 = cos(x2);
    

    now say we want to multiply f1*f2, we need them to have the # of elements, so

     f2i= interp1(x2,f2,x1,'spline');
    

    will make f2 to have the same # of elements as f1, or instead

     f1i= interp1(x1,f1,x2,'spline');
    

    will make f1 to have the same # of elements as f2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing some problem while returning data from web services. I am using
I am using mysql and facing some problem. I want to retrieve last row
Im currently facing the problem that when i try to set focus on some
I've been making some ajax function these days, and I'm facing a small problem.
i am facing some problem with files with huge data. i need to skip
can anyone help me, am facing some problem with the datetime function in the
I'm facing some problem when I fetch page content of particular Id. I'm using
Hi guys I am using entity framework, I am facing some problem while checking
facing some problem with java virtual machine initialization. when i am using root account
I am using a magento for my site. I am facing the some problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.