Huber function matlab plotting with two intervals
Mostra commenti meno recenti
Hello,
I was trying to write this simple matlab function:
rho(eps)=0.5*eps^2 for eps<=k
rho(eps)=k*eps-0.5*k^2 for eps>k
for k=1.345
so my solution was:
k=1.345;
for eps=0:0.001:6
if eps<=k
f1=0.5*(eps^2);
else
f1=k*eps-0.5*(k^2);
end %if loop
end %for loop
plot(eps,f1)
There was almost empty graph and sometimes only linear function although this function is supposed to be nonlinear in the first part and linear in the other part.
and also i'm supposed to plot the derivative of this function after this is complete.
Risposta accettata
Più risposte (3)
Categorie
Scopri di più su R Language in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!