how to run this function into one way run?

how to run this function into one way run?
i have to change always k at 1, 2,3,4,5,6...
how to run it in one times debug?
.
k=1,2,3,4,5,6,7..etc; i have to change it as 1, 2, 3,4,5,6,7...
.
w=8; constant
x=2; constant
a=0.2 ; constant
w=(0:0.3:3);
.
S=[1-exp(-a.*x.*k.*w)];
figure(1)
plot(w,S,'-+');
xlabel('w');
ylabel('S');
hold off

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 23 Nov 2012
Modifié(e) : Azzi Abdelmalek le 23 Nov 2012
k=[1,2,3,4,5,6,7]
w=8;
x=2;
a=0.2 ;
w=(0:0.3:3)
S=cell2mat(arrayfun(@(k) 1-exp(-a*x*k.*w),k','un',0))
close
plot(w,S,'-+');
xlabel('w');
ylabel('S');

7 commentaires

uncung fgv
uncung fgv le 23 Nov 2012
I will check it now. I hope you are my angel. i ll tell you next. thx
uncung fgv
uncung fgv le 23 Nov 2012
Modifié(e) : uncung fgv le 23 Nov 2012
how to thanx to you my angel? happy weekend. btw it is the beginning of my problem. the next problem is:
i want to calculate from that plots the :
(S3-S2)/(S2-S1),
(S4-S3)/(S3-S2),
(S5-S4)/(S4-S3),
(S6-S5)/(52-S4),
and soon, Sn...
where in this case S is my y value or ylabel.
this Sn lies at same straight axis x.
i hope you can share to me again. many thanks. i am very glad. i dont know how to greet in the best way.
uncung fgv
uncung fgv le 23 Nov 2012
i keep the acccept answer. still waiting the solving of that my advanced problem.
Azzi Abdelmalek
Azzi Abdelmalek le 23 Nov 2012
What does that mean? and why have you flagged my answer?
uncung fgv
uncung fgv le 23 Nov 2012
Modifié(e) : uncung fgv le 23 Nov 2012
what does mean flag? i dont get what flag means in this forum. ok i ll remove it. LOL i dont know what flag is. sorry.
Azzi Abdelmalek
Azzi Abdelmalek le 23 Nov 2012
uncung, If you have another question, just post a new one. And my first question was about your previous comment.
uncung fgv
uncung fgv le 23 Nov 2012
ok i send new question about this. thx

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by