minimize integral function for a parameter

3 Ansichten (letzte 30 Tage)
m ps
m ps am 19 Feb. 2016
Beantwortet: jgg am 19 Feb. 2016
hello everybody!I'd like to find the value of parameter 'k' that minimizes the integral function F=integral((asin(k*sin(x))-0.7*x)^2) in the interval [-pi/4,+pi/4]. how to do? thanks

Antworten (1)

jgg
jgg am 19 Feb. 2016
I think you can do something like this. Make a file with your integral that takes in k:
function [ F ] = int_fun(k)
fun = @(x)((asin(k*sin(x))-0.7*x).^2);
F=integral(fun,-pi/4,pi/4);
end
Then in your script run:
func = @(k)int_fun(k);
fminunc(func,0);
If you know a better starting point than zero or have constraints on k you can include them at this point.

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by