how to define breaks in mkpp()?

조회 수: 5 (최근 30일)
Avinash Bhatt
Avinash Bhatt 2019년 5월 2일
답변: Vidhi Agarwal 2024년 11월 26일
mkpp(breaks,coefs);
If I have 256 coefficients then how can I define breaks?
  댓글 수: 1
Avinash Bhatt
Avinash Bhatt 2019년 5월 13일
if I have a matrix of 256 coefficients, suppose :
X=imread('cameraman.tif');
and I want to create the piecewise polynomial structure using mkpp(breaks, coeffs) where coeffs will be the pixel intensity values then how breaks can be defined.

댓글을 달려면 로그인하십시오.

답변 (1개)

Vidhi Agarwal
Vidhi Agarwal 2024년 11월 26일
To use "mkpp" with a matrix of 256 coefficients, you need to define a corresponding set of breakpoints. The number of breakpoints should be one more than the number of polynomial pieces you want to create. If you have 256 coefficients and you want to create a piecewise polynomial where each piece corresponds to a single coefficient, you'll need 257 breakpoints.
Below are the steps to define breakpoints:
  • Since "mkpp" expects the number of pieces to be one less than the number of breakpoints, and you have 256 coefficients, you should create 257 breakpoints.
  • Assume you want each coefficient to apply over a uniform interval, you can define breakpoints as a simple linear space.
Sample code for the same is given below:
X = imread('cameraman.tif');
Xn = double(X); % Convert to double for polynomial operations
% Step 2: Define Breakpoints
% Assuming you want each intensity level to be a piece, create 257 breaks
breaks = linspace(0, 256, 257); % Breakpoints from 0 to 256
% Step 3: Define Coefficients
% Use pixel intensities as coefficients for piecewise constant polynomials
% Assuming each piece is a constant polynomial (order 1)
coeffs = [Xn(:), zeros(numel(Xn), 1)]; % Each row is [a0, a1] for constant a0
For better understanding of breakpoints in "mkpp" refer to the follwoing documentation:
Hope that helps!

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by