Info

此问题已关闭。 请重新打开它进行编辑或回答。

I want to edit this function==> diff(A(:,2​:end),1,2)​./diff(A(:​,1:end-1),​1,2), in order to create new q2,q3,q4..

2 次查看(过去 30 天)
I am sory i back again.
The answer yesterday very helpful.
but, it was only for 1 x-value. my x-value are from w1 until w9 or 10.
this was my function and parameter:
.
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');
that function will produce column w1, w2, w3..w11 this:
ans =
Columns 1 through 6
0 0.1131 0.2134 0.3023 0.3812 0.4512
0 0.2134 0.3812 0.5132 0.6171 0.6988
0 0.3023 0.5132 0.6604 0.7631 0.8347
0 0.3812 0.6171 0.7631 0.8534 0.9093
0 0.4512 0.6988 0.8347 0.9093 0.9502
0 0.5132 0.7631 0.8847 0.9439 0.9727
0 0.5683 0.8136 0.9195 0.9653 0.9850
Columns 7 through 11
0.5132 0.5683 0.6171 0.6604 0.6988
0.7631 0.8136 0.8534 0.8847 0.9093
0.8847 0.9195 0.9439 0.9608 0.9727
0.9439 0.9653 0.9785 0.9867 0.9918
0.9727 0.9850 0.9918 0.9955 0.9975
0.9867 0.9935 0.9968 0.9985 0.9993
0.9935 0.9972 0.9988 0.9995 0.9998
and
by using the function below:
diff(A(:,2:end),1,2)./diff(A(:,1:end-1),1,2)
i will produce q value for only from first coulum as above, in my result as:
Columns 1 through 6
0.8869 0.8869 0.8869 0.8869 0.8869 0.8869
0.7866 0.7866 0.7866 0.7866 0.7866 0.7866
0.6977 0.6977 0.6977 0.6977 0.6977 0.6977
0.6188 0.6188 0.6188 0.6188 0.6188 0.6188
0.5488 0.5488 0.5488 0.5488 0.5488 0.5488
0.4868 0.4868 0.4868 0.4868 0.4868 0.4868
0.4317 0.4317 0.4317 0.4317 0.4317 0.4317
Columns 7 through 9
0.8869 0.8869 0.8869
0.7866 0.7866 0.7866
0.6977 0.6977 0.6977
0.6188 0.6188 0.6188
0.5488 0.5488 0.5488
0.4868 0.4868 0.4868
0.4317 0.4317 0.4317
this q is only for one x-value (coulum first), in this case w1.
xlabel=w
ylabel=S
.
my goal is to produce next q2, q3...q9 or 10 from the columns w1, w2, w3, ..w9 .
maybe by editing the equation above:
diff(A(:,2:end),1,2)./diff(A(:,1:end-1),1,2)
which A refer to ans, or S.
i tried by my self like this
diff(A(:,2:end),2,3)./diff(A(:,1:end-1),2,3)
but the command state:
Empty array: 7-by-0-by-0

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by