MATLAB Troubleshooting MATLAB Functions and Variables

Click For Summary
The user is struggling to define functions and variables within a single MATLAB script, encountering errors when trying to reference functions and constants across different files. They are attempting to create a function named "betaf" but are unsure how to integrate it with constant values defined in a separate script. A suggestion is made regarding the potential confusion with the function name "gammaf," which may not exist in MATLAB, as there is a built-in function called "gamma." The user seeks a solution to effectively manage multiple functions and constants in their MATLAB projects. Clarifying function names and understanding the structure of MATLAB scripts and functions is essential for resolving these issues.
bocuk
Messages
1
Reaction score
0
i have a question.
i just try to learn MATLAB however i couldn't define the functions and variables inside the one script. i open new script file and give the function comment in it for example like this...


function [ y ] = betaf( x,Ee)
lambda=0.1;
y=100*gammaf(Ee)*lambda/(2*pi*x);

end


i also put constant values to script file but program doesn't recognize the function comment it gives error, i do this process in the function file...i define the function in function file and the values in script file... and then it doesn't read the constant values from the script file or script file doesn't see the function. i
i want to use about 10-15 function in the MATLAB and to put the values in one script ,then i but i coldnt. or may be any easy way to make it?

can anybody help me?
 
Physics news on Phys.org
bocuk said:
y=100*gammaf(Ee)*lambda/(2*pi*x);
What function is this gammaf? Matlab has a function gamma (without a "f"), maybe you meant that one?
 

Similar threads

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