Filter löschen
Filter löschen

How to use cgs with your own matrix-vector multiplication?

2 Ansichten (letzte 30 Tage)
Joe kiao
Joe kiao am 16 Nov. 2015
Bearbeitet: James Tursa am 16 Nov. 2015
From doc cgs I see, you can call the cgs function like:
x=cgs(@afun, b);
function afun is your self defined matrix vector multiplication function. But how pass parameters to afun? If function afun is defined as
function y=afun(a, b, c, d)
As you can see, afun uses 4 parameters. How to pass them to afun? Can one just use the following
x=cgs(@afun(a,b,c,d), b)
Thanks!

Akzeptierte Antwort

James Tursa
James Tursa am 16 Nov. 2015
Bearbeitet: James Tursa am 16 Nov. 2015
If a,c,d are pre-existing constant terms, you could use an anonymous function. E.g.,
afun2 = @(b)(afun(a,b,c,d))
then
x = cgs(afun2, b)

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox 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!

Translated by