what happen when I Divide 1:3/4:6 ??

hello everybody .... hope you are well :)
maybe it's a silly question but really I could not fine the answer :S
when i type this :
1:3/4:6 what happen ??
I thought it divide two arrays, so i defined x = [1 2 3]; y = [4 5 6]; x/y
but the answer was different :S
anyone can give the idea plz :$

 Accepted Answer

Image Analyst
Image Analyst on 14 Jul 2013
1:3/4:6 is the same as 1 : (3/4) : 6.
And I think you want x ./ y which is an element-by-element divide, instead of x/y which is a matrix inversion.

2 Comments

mmmm yeah it takes a step and find the series ...
but x./y also different my friend from it because their as we found its only find a series.
thank you ... :)
Well, what do you want as the output? x ./ y gives [0.25, 0.4, 0.5]. Evidently that "series" or array is not what you want but we don't know what you do want.

Sign in to comment.

More Answers (1)

when i type this :
1:3/4:6
Read section "operator precedence" in the Matlab section on arithmetic operators. Followed on by
doc colon
The combination explains all...

1 Comment

Ok i gonna take your advise ... thank you a lot :)

Sign in to comment.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!