Build a matrix of data and insert them in a function
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a function. Suppose
function y=A(1)*B+A(2)
in which A is an array of 2 x m elements and B is a vector of n elements. The A(1,:) is varies while A(2,:) is a contant number. I would like to multiply all the elements of B with each one of the elements of A in order to build a matrix of y outputs.
My ultimate goal to mesh all this data and produce surface plot. I would like to use for loops to avoid the dots before the operators because actually I have a complicated function Thank you.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 19 Dez. 2012
It was not clear how A(2,:) fit in, but perhaps
bsxfun(@times, B(:), A(1,:)) + A(2*ones(1,length(B)), :)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!