Making my own operator
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
SAA
il 20 Set 2019
Risposto: Walter Roberson
il 20 Set 2019
How can I make my own operator and apply it to a function like I want my operator (
) my function ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/239082/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/239075/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/239082/image.png)
0 Commenti
Risposta accettata
Walter Roberson
il 20 Set 2019
MATLAB does not permit you to create new operators.
MATLAB does permit you to redefine many of the existing operators, such as redefining plus() to affect the operator known as + . There are only a small number of operators that cannot be redefined. However, doing this for an existing data class is often risky as it often interferes with existing use of the operator.
Chances are that you should create a function instead of an operator. That function might be a method for a new class you define.
In your situation, provided that you have access to the symbolic toolbox, then I would suggest something like:
MyOp = @(f) -diff(f,y,2) + f.^2;
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Software Development Tools in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!