In the Matlab program below(adsbygoogle = window.adsbygoogle || []).push({});

U=[210; 100; 150]

ky= linspace(-.2,.2);

qx=sqrt(((150-U)/.2)^2-ky.^2)

I want to have qx as a matrix in which each row is corresponding to one value of U: the first row corresponds to 210, the second to 100 and .... How should I do this? (I want to avoid the "for loop" if possible).

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab and preparing matrix lines

**Physics Forums | Science Articles, Homework Help, Discussion**