number divided by vector
Show older comments
Hi everyone~ I divided a number by a vector and forgot to use ./ Why it didn't report error and gave me some result? What's the meaning of this calculation? Thank you!
t = (1: 0.5: 50)';
Carnot = 1-295/(500*exp(-0.02*t)+300);
Answers (4)
yonatan gerufi
on 9 Nov 2014
Edited: yonatan gerufi
on 9 Nov 2014
This is a tricky thing.
a. the command:
10/ [10,20]'
is equal (from matlab point of view) to:
[10;0]/ [10;20]
but the results will be just the non zeros line.
b. the command:
10/ [50,20]' (first element in denominator is larger)
is equal (from matlab point of view) to:
[0;10]/ [10;20]
but the results will be just the non zeros line.
1 Comment
Yuji Zhang
on 9 Nov 2014
yonatan gerufi
on 9 Nov 2014
that's a good question, i believe both needs to be illegal.
how do you suggest matlab will understand the command:
1/[1,2]' ?
[1;0]/[1;2] or [1;1]/[1;2] or perhaps [0;1]/[1;2] ?
there is lack of clarity.
if the previous answer answers your question you can do "accept answer" so people will know.
good luck!
Yuji Zhang
on 9 Nov 2014
Edited: Yuji Zhang
on 9 Nov 2014
Shoaib Waqar
on 22 Jan 2020
0 votes
you can try
1./matrix
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!