MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by uncung fgv
on 23 Nov 2012

i have to calculate the value of

(S3-S2)/(S2-S1) =q1

(S4-S3)/(S3-S2)=q2

(S5-S4)/(S4-S3)=q3

(S6-S5)/(52-S4)= q4

until qn

from this function below:

k=[1,2,3,4,5,6,7];

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');

S1 is S at y ordinate of plot 1

S2 is S at y ordinate of plot 2

S3 is S at y ordinate of plot 3

until S7

at w1, w2, w3, until wn

so my goal:

i want to calculate the q1 until qn at w1 until wn for all plots.

so means :

q1, q2, ... qn at w1

next q1, q2, ... qn at w2

next q1, q2, ... qn at w3

next q1, q2, ... qn at w4

until wn.

so xlabel=w

ylabel=S

determination (S3-S2)/(S2-S1)=q1 (example)

and want to find q1, q2, q3,... qn at w1, w2, w3, w4...wn

*No products are associated with this question.*

## 1 Comment

## uncung fgv (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54634#comment_113017

by using matlab.