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

  • SEARCH
  • Home
  • 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 7573217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:07:36+00:00 2026-05-30T16:07:36+00:00

I have an anonymous function in matlab: f=@(x) x/(1+x^4) . I want to integrate

  • 0

I have an anonymous function in matlab: f=@(x) x/(1+x^4). I want to integrate it from 0 to 1 with quad, but for some reason mpower is complaining that it can’t take x^4 because “Inputs must be a scalar and a square matrix.” If I replace x^4 with x*x*x*x, I get “Error using ==> mtimes Inner matrix dimensions must agree.” Here’s the full error output.

??? Error using ==> mpower
Inputs must be a scalar and a square matrix.

Error in ==> intapprox>@(x)x/(1+x^4) at 4
f=@(x) x/(1+x^4);

Error in ==> quad at 77
y = f(x, varargin{:});

Error in ==> intapprox at 27
area = quad(f,0,1);
  • 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-05-30T16:07:38+00:00Added an answer on May 30, 2026 at 4:07 pm

    Use f=@(x) x./(1+x.^4); i.e. ./ and .^ since you don’t want to do a matrix divide and power. Then I get

    >> area = quad(f,0,1)
    area =
    
        0.3927
    

    Which is consistent with the analytical value of pi/8.

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

Sidebar

Related Questions

I have gotten JSONP working with an anonymous function but can't get it to
I have some Matlab functions that I have to translate in C but I
I have a function that accepts an anonymous function as an argument and sets
You have to pass the args variable to the anonymous function, but the anonymous
Is it possible to have a PHP function that is both recursive and anonymous?
From Mathworks An anonymous function consists of a single MATLAB expression and any number
I have a class that uses 5.3 feature anonymous function ( https://github.com/JeffreyWay/Easy-WordPress-Custom-Post-Types/blob/master/jw_custom_posts.php ), but
I have a function that I want to return true or false. Inside the
I know you can create an anonymous function, and have the compiler infer its
I quite often have to bind? some function that requires arguments. The solution I

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.