0
votes

I´ve got an integral equation I need to solved numerically with Matlab and I'm currently stuck. I just need some help with the key ideas on how to handle these problems with Matlab, so I'll keep it stripped from most mathematics.

enter image description here

In my code Z, g and omega: w are vectors of the same size such that Z(1) corresponds to w(1) etc. and f is a function.

How do I treat the "shift" w-w_prime in the best way? I don't have a good way to handle the case when w-w_prime corresponds to an argument outside Z or g. I've been thinking that I can use the fact that Z, g and f, in my problem, corresponds to even functions, but I don't quite know how.

1
Not quite clear what your problem is - please state the integration formula you want to use, and in particular what you mean by w and why you would want to evaluate it outside of the domain of Z. You might find that linear interpolation of the values will give you the "mid points" you are looking for; or you could look at functions like convn which allow you to do a convolution (with the 'same' optional argument it takes care of the shift for you). - Floris
Sorry, tried to post an image but that didn't work... I've added a link instead. - joakimj
This looks a lot like the convolution of f with gZ. Am I understanding that correctly? But Z is on both sides of the equation which is a little scary - I suppose this is why you say you need to "solve" the equation (as opposed to "evaluate" the integral, which is only the half of it). Are you solving for Z, g, f? - Floris
Yes, I've been trying to use convolution on this problem, but I don't get the correct solution. However I might do something wrong. I was wondering if there is a way to calculate the actual integral with numerical integration. But I should probably give convolution another try. - joakimj
All numerical integration requires the evaluation of a series of points. Have you given any thought about the properties of your function, and thus the best method of integration? Entire books have been written about this - you can't "just integrate" if you care about accuracy (especially if your function has discontinuities or other "strange" behavior). That is not a Matlab issue - that's much bigger. So I suggest you write out the expression you would like to evaluate - discrete summation, not an integral - and we'll help you convert to Matlab. - Floris

1 Answers

0
votes

A few thoughts to get you started:

  1. You should probably define the domain over which you want Z to exist; and you should set Z=0 outside of this domain. That will help you deal with the fact that your expression is looking to evaluate Z for all possible values of ω
  2. The convn function might be quite helpful in evaluating the "integral" - although it will in fact just do a sum-shift-add type operation, so not really proper numerical integration.
  3. There are various nonlinear solvers built into matlab's optimization toolbox - I find it quite handy to use these when I have tough equations like this to solve.
  4. Your life is more complicated by the fact that (I think you say) you have values of Z tabulated at points corresponding to ω - and that therefore these points might not be equally spaced. For functions like convn you need equal spacing and you might want to do an interpolation:

    Zequal = interp1(w, Z, 1:maxW);

would give you values of Z equally spaced (based on the values observed at the points (w, Z(w)). You can use higher order interpolation (e.g. interp1(w, Z, 1:maxW, 'cubic');) to get a smoother function.

These are just some thoughts to get you (and others reading this post) started...