a basic question for a beginner
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!