a basic question for a beginner
이전 댓글 표시
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):
clc
close all
x=(1:0.1:10);
y=(x.*sin(x))./exp(x);
Ymin=min(y)
Xmin=x(y==Ymin)
plot (x,y);
hold on
plot (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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!