How do I write this algorithm, I dont understand it and I am stuck.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nathan Clark
el 13 de Abr. de 2023
Respondida: Gokul Nath S J
el 20 de Abr. de 2023
Ax = b and S is a surrogate smoother
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355523/image.jpeg)
1 comentario
dpb
el 14 de Abr. de 2023
Has to be more context; S, A and b are undefined above...they must come from supporting text prior to the above...
Respuesta aceptada
Gokul Nath S J
el 20 de Abr. de 2023
Hi Nathan,
Based on your query, it seems that you would like to implement the algorithm. I can share the general workflow considering some contraints.
The following variables are assumed to be predefined. (
)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1361953/image.png)
Considering this constraints,
Step 1: Initialize the variables
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1361958/image.png)
Step 2: Start the for loop from the starting value of k = 1
Step 3: Inside the loop update the value of
for the iteration to continue in the next round.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1361963/image.png)
Step 4: Once the loop termination condition occur, update the final value to x and return it.
A reduced code is attached below considering the constraints mentioned in the step 1.
function xk = ChebyshevSmoother(lambda_max, lambda_min, S, A, x, b, chebyshevOrder)
theta = 0.5*(lambda_max+lambda_min);
delta = 0.5*(lambda_max-lambda_min);
sigma = theta/delta;
rho = 1/sigma;
r = S*(b-A*x);
dk = r/theta;
xk = 0;
for k = 1:chebyshevOrder
xk = xk + dk;
r = r - S*A*dk;
rho_kplusone = 1/(2*sigma-rho);
dk = rho_kplusone*rho*dk + 2*rho_kplusone*r/delta+1;
rho = rho_kplusone;
end
xk = xk +dk;
end
Thanks,
Gokul Nath S J
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!