How to find k so that the integral from 0 to k equals a number

I have a program where I am finding the area of a function from 0 to a known number and then finding an integral so that the area under the function on the other side of this number is equal to the first area. I'm trying to do this with some simple code first and then once I understand it apply it to the program. I'm really confused on how to go about doing this. This is something I tried but I don't think this is anywhere close to working. Thanks for any help you can give me.
syms x k
a = int(sym('x^2'),0,4);
b = int(sym('x^2'),4,k);
solve('a = b')

Answers (2)

1.
f = @(x)x.^2;
out = fzero(@(x)quad(f,0,4)-quad(f,4,x),5)
2.
syms y x real
out2 = solve(int(x.^2,x,0,4)-int(x.^2,4,y),y)

Asked:

on 6 Nov 2011

Community Treasure Hunt

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

Start Hunting!