1
$\begingroup$

I'm trying create a function that returns a matrix containing a variable "l" which is an independent variable to be swept for a plot later on.

I would calculate "phi" based on user inputs which include "n" and "d", then I would use "n", "d", and "phi" to find "a", "b", "c", and "d" to create a matrix "m" with. This matrix "m" will be a function of "l".

phi = 2*pi*n*d/l; a = cos(phi); b = 1i*sin(phi)/n; c = 1i*n*sin(phi); d = cos(phi); m = [a b;c d]; 

I'm really not enjoying Matlab's coding style as compared to C++ and Python... How would you guys implement this functionality?

Summary: I want a function that returns a matrix which contains an independent variable to be swept for a plot later.

  • 0
    This question may be better suited for stackoverflow.2011-02-04
  • 0
    Okay, I'll try over there.2011-02-04

1 Answers 1