Plotting current versus energy with MATLAB step function

1 reply · 6K views · last reply
soha
Messages
5
Reaction score
0
step function using MATLAB :D

hey guyzzzz
i got a problem with this MATLAB program ...um a beginner in using MATLAB :D...and my professor insists to solve the attached problem with MATLAB without using "if statement" and in one line command and to plot the current versus the energy...may anyone help please :D
 
Attachments
  • Piecewise equation for I_e(E) with three cases: first for E < E_L, second for E_L ≤ E ≤ E_H, and zero for E > E_H, each with a square-root and cube-root expression.
    prob.jpg
    12.4 KB · Views: 647


Explore this as a learning exercise.

Code:
A = 1:10  % Copy+Paste this line

A =

     1     2     3     4     5     6     7     8     9    10

class(A)  % Copy+Paste this line

ans =

double

idx = A<=5   % Copy+Paste this line

idx =

     1     1     1     1     1     0     0     0     0     0

class(idx)   % Copy+Paste this line

ans =

logical

A(idx)    % Copy+Paste this line

ans =

     1     2     3     4     5

A(idx)=0    % Copy+Paste this line

A =

     0     0     0     0     0     6     7     8     9    10

That should give you enough to do your problem.