derivative of a conditional function

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I have a $(N*M)$ mask named $h$ which is 1 everywhere except inside a circle. I write the function form of $h$ as below:



$h(x,y, r) =begincases
0 & text if (x-c_x)^2+(y-c_y)^2 leqslant r^2 \
1 & text if (x-c_x)^2+(y-c_y)^2 > r^2
endcases$



Consider function $f$ as below:



$f(x,y, r) = frac12sum_x=0^N sum_y=0^M left ( h(x,y,r) ,mathbft(x,y)-mathbft^'(x,y)right )^2$



where $mathbft$ and $mathbft^'$ are $(N*M*5)$ arrays which are given from measurements, I want to find the optimal $r$ such that $h mathbft$ is as colse as possible to $mathbft^'$ which is the reference array. Then I have to minimize $f$ with respect to parameter $r$. Can anyone help me how to find total and gradient of function $f$?







share|cite|improve this question





















  • Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
    – José Carlos Santos
    Aug 2 at 12:40










  • Instead of typing "f" I suggest that you type $f$.
    – md2perpe
    Aug 2 at 12:59










  • What is the sum taken over?
    – md2perpe
    Aug 2 at 12:59










  • Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
    – md2perpe
    Aug 2 at 13:01














up vote
-1
down vote

favorite












I have a $(N*M)$ mask named $h$ which is 1 everywhere except inside a circle. I write the function form of $h$ as below:



$h(x,y, r) =begincases
0 & text if (x-c_x)^2+(y-c_y)^2 leqslant r^2 \
1 & text if (x-c_x)^2+(y-c_y)^2 > r^2
endcases$



Consider function $f$ as below:



$f(x,y, r) = frac12sum_x=0^N sum_y=0^M left ( h(x,y,r) ,mathbft(x,y)-mathbft^'(x,y)right )^2$



where $mathbft$ and $mathbft^'$ are $(N*M*5)$ arrays which are given from measurements, I want to find the optimal $r$ such that $h mathbft$ is as colse as possible to $mathbft^'$ which is the reference array. Then I have to minimize $f$ with respect to parameter $r$. Can anyone help me how to find total and gradient of function $f$?







share|cite|improve this question





















  • Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
    – José Carlos Santos
    Aug 2 at 12:40










  • Instead of typing "f" I suggest that you type $f$.
    – md2perpe
    Aug 2 at 12:59










  • What is the sum taken over?
    – md2perpe
    Aug 2 at 12:59










  • Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
    – md2perpe
    Aug 2 at 13:01












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have a $(N*M)$ mask named $h$ which is 1 everywhere except inside a circle. I write the function form of $h$ as below:



$h(x,y, r) =begincases
0 & text if (x-c_x)^2+(y-c_y)^2 leqslant r^2 \
1 & text if (x-c_x)^2+(y-c_y)^2 > r^2
endcases$



Consider function $f$ as below:



$f(x,y, r) = frac12sum_x=0^N sum_y=0^M left ( h(x,y,r) ,mathbft(x,y)-mathbft^'(x,y)right )^2$



where $mathbft$ and $mathbft^'$ are $(N*M*5)$ arrays which are given from measurements, I want to find the optimal $r$ such that $h mathbft$ is as colse as possible to $mathbft^'$ which is the reference array. Then I have to minimize $f$ with respect to parameter $r$. Can anyone help me how to find total and gradient of function $f$?







share|cite|improve this question













I have a $(N*M)$ mask named $h$ which is 1 everywhere except inside a circle. I write the function form of $h$ as below:



$h(x,y, r) =begincases
0 & text if (x-c_x)^2+(y-c_y)^2 leqslant r^2 \
1 & text if (x-c_x)^2+(y-c_y)^2 > r^2
endcases$



Consider function $f$ as below:



$f(x,y, r) = frac12sum_x=0^N sum_y=0^M left ( h(x,y,r) ,mathbft(x,y)-mathbft^'(x,y)right )^2$



where $mathbft$ and $mathbft^'$ are $(N*M*5)$ arrays which are given from measurements, I want to find the optimal $r$ such that $h mathbft$ is as colse as possible to $mathbft^'$ which is the reference array. Then I have to minimize $f$ with respect to parameter $r$. Can anyone help me how to find total and gradient of function $f$?









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Aug 2 at 13:32
























asked Aug 2 at 12:33









Negar

61




61











  • Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
    – José Carlos Santos
    Aug 2 at 12:40










  • Instead of typing "f" I suggest that you type $f$.
    – md2perpe
    Aug 2 at 12:59










  • What is the sum taken over?
    – md2perpe
    Aug 2 at 12:59










  • Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
    – md2perpe
    Aug 2 at 13:01
















  • Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
    – José Carlos Santos
    Aug 2 at 12:40










  • Instead of typing "f" I suggest that you type $f$.
    – md2perpe
    Aug 2 at 12:59










  • What is the sum taken over?
    – md2perpe
    Aug 2 at 12:59










  • Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
    – md2perpe
    Aug 2 at 13:01















Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
– José Carlos Santos
Aug 2 at 12:40




Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. This should be added to the question rather than in the comments.
– José Carlos Santos
Aug 2 at 12:40












Instead of typing "f" I suggest that you type $f$.
– md2perpe
Aug 2 at 12:59




Instead of typing "f" I suggest that you type $f$.
– md2perpe
Aug 2 at 12:59












What is the sum taken over?
– md2perpe
Aug 2 at 12:59




What is the sum taken over?
– md2perpe
Aug 2 at 12:59












Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
– md2perpe
Aug 2 at 13:01




Does $*$ denote ordinary multiplication? If so, I suggest just skipping it, perhaps replacing it with , to make a small space between the factors.
– md2perpe
Aug 2 at 13:01















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2870025%2fderivative-of-a-conditional-function%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2870025%2fderivative-of-a-conditional-function%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?