how to define functions with variable values
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
John
am 21 Aug. 2014
Bearbeitet: Star Strider
am 23 Aug. 2014
Hello,
I'm trying to define a function x1=-c1/b1*x2+d1/b1, where b1,c1,d1 are defined, but x2 should be kept as a variable. Here's how it all looks at the end

0 Kommentare
Akzeptierte Antwort
Star Strider
am 21 Aug. 2014
Bearbeitet: Star Strider
am 21 Aug. 2014
x1 = @(x2,b1,c1,d1) -c1./b1.*x2+d1./b1;
if you want to include all the constants as arguments,
or:
x1 = @(x2) -c1./b1.*x2+d1./b1;
if you want to pick the constants up automatically from the workspace.
2 Kommentare
Star Strider
am 23 Aug. 2014
Bearbeitet: Star Strider
am 23 Aug. 2014
My pleasure!
There are some truly brilliant people here. (I have my areas of expertise, but nothing to match others like Roger Stafford, Azzi Abdelmalek, Andrei Bobrov, Cedric Wannaz, and others. MATLAB staffers also appear here from time to time to provide detailed Answers the rest of us cannot.) Stay here if you need help. If you ask your Questions clearly, you will get clear Answers.
Also, contribute your own Answers as you gain expertise.
Apologise for the delay this time — GMT-6 here.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!