? Undefined function or variable 'x'.

  • Thread starter Thread starter tictaclp
  • Start date Start date
  • Tags Tags
    Function Variable
Click For Summary
SUMMARY

The discussion centers on an error encountered in MATLAB, specifically the "Undefined function or variable 'x'" message when executing the function 'funyder'. The function is intended to calculate a mathematical expression and its first derivative, but it fails due to the absence of a defined variable 'x'. Users emphasize the need to define 'x' or pass it as an argument to the function to resolve the issue.

PREREQUISITES
  • Understanding of MATLAB programming syntax
  • Familiarity with function definitions in MATLAB
  • Basic knowledge of mathematical functions and derivatives
  • Experience with variable scope in programming
NEXT STEPS
  • Learn how to define and pass variables in MATLAB functions
  • Research MATLAB error handling techniques
  • Explore MATLAB's documentation on function arguments
  • Study the implementation of mathematical functions in MATLAB
USEFUL FOR

MATLAB programmers, students learning numerical methods, and anyone troubleshooting function errors in MATLAB.

tictaclp
Messages
3
Reaction score
0
? Undefined function or variable 'x'.

function [ f, f1] = funyder( z )
%funcion y primera derivada del primer ejercicio
f=1-1/(1-x+2*z^2)
f1=(4*z-1)/(1-z+2*z^2)^2

this doesn't work .
Thanks
 
Physics news on Phys.org


tictaclp said:
function [ f, f1] = funyder( z )
%funcion y primera derivada del primer ejercicio
f=1-1/(1-x+2*z^2)
f1=(4*z-1)/(1-z+2*z^2)^2

this doesn't work .
Thanks

Welcome to PhysicsForums. Note the bolded bits above!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K