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 4024306
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:42:20+00:00 2026-05-20T10:42:20+00:00

The main problem here is to evaluate the user function at some point because

  • 0

The main problem here is to evaluate the user function at some point because we don’t know if the user will enter a function in x domain or another domain

I tried this but it doesn’t work:

function y = f(~)
y = input('Enter you function: ');
end

and this is what I want:

>>f
Enter you function: a^2+3*a-3
>>f(1)
ans =
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-20T10:42:21+00:00Added an answer on May 20, 2026 at 10:42 am

    This solution almost provides the exact requirements in your question. I’d feel kind of queezy using this though with the EVAL. You’d also want to wrap some error checking into this.

    classdef f < handle
    
        properties (Access = private)
            functionString = '';
        end
    
        methods
            function obj = f
                if nargin == 0
                    obj.functionString = input('Enter your function: ', 's');
                end
            end
    
            function value = subsref(obj, a)
                a = a.subs{:};
                value = eval(obj.functionString);
            end
    
            function display(obj)
    
            end
        end
    
    end
    

    You can then use this class like:

    >> a = f
    Enter your function: a^2+3*a-3
    >> a(1)
    
    ans =
    
         1
    
    >> a(2)
    
    ans =
    
         7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll only try to present the main part of the problem, because the whole
Here is the main problem. I have very large database (25,000 or so) of
I have a peculiar problem here. I want to extract some generic types, which
The main problem here is with search url: http://code.google.com/intl/it/query/#p=appengine&q=query It doesn't contain ? symbol,
I found several examples how to use Ext.ux.grid.GridSummary() in GridPanel, main problem here is
Main problem: how do i group elements by their Date, only if continuous and
The main problem is as follows: I did my code in console application and
Scroll.js is used for #bird block, which follows the page scrolling. The main problem
I have a problem in integrating PHP and JQuery: My main file is MyFile.html
Short problem: #include <iostream> using namespace std; int main() { double **T; long int

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.