Matlab interp1 c code6/24/2023 ![]() Therefore, for the first column, this means that xq(1) >= x(1), which is xq(1) >= 1, and that's great. Remember, we only want to check up to the second-last element because of the i+1 condition. ![]() This tells us which values of x that satisfies xq(1) > x(i). The first column is for the first value of xq, or 1.2, the next column is 1.6, and the next column is 2.2. You can do that by: ind = xq, x(1:end-1).') Specifically, you want to find the index i, such that a value of xq at index j satisfies: xq(j) >= x(i) & xq(j) = x(i) inequality. When doing linear interpolation, our job is to figure out which interval each y point belongs to for x. Let's say we had these x and xq values: x = We can use two bsxfun calls and take advantage of broadcasting to do this. What you can do is for each xq value, we can find which interval the value fits into. xq is a matrix of size 501x501 with x locations we wish to interpolate. Also, I have to do this linear interpolation lots of times (over 200), so it needs to be very fast and comparable to interp1 in matlab. Here is something that matches the dimensions of my input data. I have not included the quantize() commands below for clarity. Right now I am using the following equation to perform linear interpolation at specific points xq given the values y at points x. ![]() ![]() I want to modify the incoming data to a specific bitwidth (using the quantize() function), then I also want to make sure that all of the intermediate operations are done using another bitwidth. I was wondering if there is an efficient way to write the linear interpolation function in MATLAB so that it doesn't require for-loops and runs very fast? I am trying to perform linear interpolation in MATLAB using a specific precision. ![]()
0 Comments
Leave a Reply. |