Integration of a vector

2 ビュー (過去 30 日間)
Paul
Paul 2013 年 11 月 21 日
編集済み: Paul 2013 年 11 月 23 日
Hello
I have a given vector x0 and vector a1 of unknown variables. I want to get a new point x1 such that I numerically integrate function fun1(a1,x0) along vector a1 from 0 to 1. If a1 would be a sacalar it would be easy to integrate but it's a vector and I couldn't figure out how to do that. So I would like to ask if there is some function or easier way of integrating that?
Code:
x0 = [0.1; 0.2];
function res = fun1(a1,x0)
res = x0 + (((max(v(a1) - a1' * x0,0)) / (norm(x0))) * a1);
end
function res = v(a1)
res = max(a1(1,1) + a1(2,1) - 1, 0);
end
%x1 = integrate fun1 from 0 to 1
_______________
This is the part of code I'm using. It's only for 2 dimensions for now.
Thank you guys
Any help would be appreciated

採用された回答

Marc
Marc 2013 年 11 月 21 日
Have you looked at quad() or trapz() for numerical integration?
doc trapz doc quad

その他の回答 (1 件)

Paul
Paul 2013 年 11 月 23 日
編集済み: Paul 2013 年 11 月 23 日
yes i tried trapz,quad,integral... but still couldnt find the solution. Im fairly new to matlab so I started by integrating scalar, which is simple. But I cant get the integration over a vector to work.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by