Obtaining a scalar value from a vector output
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, with the given files, if you run test-modified.m and then enzymeLeastSquares.m, you obtain the necessary inputs for running
enzymeGeneral.m
So when running finally enzymeGeneral.m, it outputs F and G.
However, the output from enzymeGeneral.m should be the scalar value of the objective F and the corresponding 2x1 gradient G.
The first I get by doing
F=norm((1/2)*(sum(y0_all)).^2)
which gives the scalar value of F. However, the correspondikng 2x1 gradient G is not returned. What is the right command? Do anyone have a link to a MATLAB page that shows the relevant command?
Thanks
0 comentarios
Respuesta aceptada
Voss
el 4 de Abr. de 2024
Editada: Voss
el 4 de Abr. de 2024
% take a look at what enzymeGeneral.m is
type enzymeGeneral.m
If you want enzymeGeneral to return the F and G it calculates, change its first line to:
function [F,G] = enzymeGeneral(k)
But then, result and grad_all are calculated for no reason and the input k is unused, so I'm not sure if that's what you want.
Anyway, here's the relevant documentation:
6 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!