Matlab Zeros, What type of matrix will I get from this?

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Jose Cuevas
Jose Cuevas 2021๋…„ 2์›” 26์ผ
๋Œ“๊ธ€: Jose Cuevas 2021๋…„ 3์›” 1์ผ
Hello, I am trying to understand a code that I using in my project, could someone tell me what do I get from this operation?
scan_trous_carres0=zeros((size_lambda*size_period*size_etching_depth*size_phi),9)
The 9 comes from a column of a text file that where I am getting data, I am trying to figure out why I am I multiplying the values inside the parenthesis and then I have the 9 outisde that parenthesis. What kind of matrix will I get?
  ๋Œ“๊ธ€ ์ˆ˜: 2
dpb
dpb 2021๋…„ 2์›” 26์ผ
ํŽธ์ง‘: dpb 2021๋…„ 2์›” 26์ผ
Did you try it to see?
Where do the other variables come from would be a hint as to why the expression as well as looking for where the LHS variable is subsequently used.
Or, see what happens if you just define the variables to have some (small) integer values and then try it at command line...I promise it won't start WW III! :)
dpb
dpb 2021๋…„ 2์›” 26์ผ
ADDENDUM:
Or, just set a breakpoint in the debugger and poke around when you get there...

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ฑ„ํƒ๋œ ๋‹ต๋ณ€

Adam Danz
Adam Danz 2021๋…„ 2์›” 26์ผ
ํŽธ์ง‘: Adam Danz 2021๋…„ 2์›” 26์ผ
> could someone tell me what do I get from this operation
Assuming your variables are scalar (1 value) or, when multipled, produce a scalar, scan_trous_carres0 will be an mx9 matrix of 0s where m is the result of the multiplication. Try it, as dpb suggested, or read about it in the documentation.
> I am trying to figure out why I am I multiplying the values inside the parenthesis
We certainly don't know why you're doing that ๐Ÿ™‚. Apparently those 4 variables describe lengths or sizes of something and your output matrix needs to have that many rows. Are those values scalar? Vectors that, when combined, produce a scalar? We don't know.
This function is commonly used to preallocate loop-variables.
> and then I have the 9 outisde that parenthesis
Well, apparently you need 9 columns of 0s. size(x,y) produces a matrix of 0s of size x*y.
> What kind of matrix will I get?
A matrix of 0s of class double
To confirm,
class(scan_trous_carres0)
  ๋Œ“๊ธ€ ์ˆ˜: 1
Jose Cuevas
Jose Cuevas 2021๋…„ 3์›” 1์ผ
Thank you, it appears that I was preparing a 2D matrix of 9 columns with a long range of values in x. The values came from a loop in python, it took me a while to connect the dots.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ถ”๊ฐ€ ๋‹ต๋ณ€ (0๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Logical์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by