How do I create a matrix with functions?

I have a function with two variables, I want to generate a matrix of function outputs with one range of each output. How do I do that?

Antworten (1)

Guillaume
Guillaume am 3 Dez. 2015

0 Stimmen

The simplest way is to use bsxfun:
var1 = 1:10; %row vector for one input
var2 = (1:5)'; %column vector for the other
m = bsxfun(@yourfun, var1, var2)

Diese Frage ist geschlossen.

Tags

Gefragt:

am 3 Dez. 2015

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by