hello…I am starting learning Matlab by myself. there were some commands I could't understand and will be grateful if you answer me ASAP. I got the additional code (added as jpg file):
clcclose allx=(1:0.1:10);y=(x.*sin(x))./exp(x);Ymin=min(y)Xmin=x(y==Ymin)plot (x,y);hold onplot (x,Ymin*(x==x),'r--');plot (Xmin,Ymin,'*g');
- I have a problem to understand why Xmin=x(y==Ymin) makes the software to find the appropriate x value to the minimum Y value. According to what I learned the operation of == should be implemented on the same size subjecs, eg. scalar==scalar or vector==vector, what isn't the case here (vector==scalar). In addition the outcome of the above operation should be 0/1 – so I can't understand how this outcome represents the desired index (which is 32).
- I can't understand from the syntax why the command plot(x,Ymin*(x==x),'r–'); makes the software draw a horizontal line y=Ymax. I specially can't understand what the mid-term Ymin*(x==x) mean.
Best Answer