开发者

Symbolic Math in MATLAB, solving simple integration

开发者 https://www.devze.com 2022-12-21 09:19 出处:网络
I have a problem with solving a simple integration through MATLAB. I want to solve this symbolic and don\'t have any problems doing this through other programs.

I have a problem with solving a simple integration through MATLAB. I want to solve this symbolic and don't have any problems doing this through other programs.

Well I have this equation:

syms k x

fX(x) = k * e^(-3*x) for 2 <= x <= 6

which I want to integrate from the interval 2 to 6. Then I would solve the equation, so that fX(x) = 1, and solve the equation for k. I type:

S = solve('int(k*exp(-3*x),x,2,6) = 1',k);

And I get following error: Error, (in int) wrong number (or type) of arguments: invalid opt开发者_运维技巧ions or option values passed to indefinite integration. Unknown options: {2, 6}

Why can't the int-function not take my limits?


solve(int(k*exp(-3*x),x,2,6) - 1,k) should work :)

Notice:

  1. don't use = 1 but -1 (that means f(x) - 1 = 0)
  2. don't use ''

The result for me is:

-(3*exp(6))/(1/exp(12) - 1)

I also tried to solve it by hand and got the same result.

0

精彩评论

暂无评论...
验证码 换一张
取 消