number divided by vector
37 views (last 30 days)
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);
0 Comments
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.
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!
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements 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!