can any body help me how to use "arrayfun" to update parameter with in "for loop"? is it possible?
Ältere Kommentare anzeigen
example problem i want to solve
function q=initial(p,cn)
for i=1:100
s(i,1)=(25400/cn(i,1))-254;
q(i,1)=(((p(i,1)-0.2*s(i,1)).^2)./(p(i,1)+0.8*s(i,1)));
s(i+1,1)=s(i,1)+(0.1*q(i,1));
end
%%i want to update the "s" value in each iteration
p=gpuArray(randi([0 5],100,1));
cn=gpuArray(randi([70 85],100,1));
a=arrayfun(@initial,p,cn);
%%this is how i want to use "arrayfun"
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!