how to generate a polynomial

i have two matrix one is
s=[2 3
4 5]
other is
text = [3 5 6 7
3 4 5 6]
based on my threshold value i should form a polynomial
say for exam threshold is 2 my polynomial should be
P= s(1,1)*x^0 + text(1,1)*x^1
if threshold is 3 my polynomial should be
P= s(1,1)*x^0 + text(1,1)*x^1 + text(1,2)*x^2 i have to process for every
digit like this .... value from should be taken once but from text van be any
number of times based on threshold...
Thanks in advance ..i am not able to trace it out please help

15 comentarios

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
is it always s(1,1)?
Matt Fig
Matt Fig el 24 de Nov. de 2012
Yes, what is the general pattern? Are the other elements of S never used?
Sharen H
Sharen H el 24 de Nov. de 2012
its like s(i,j) and the polynomial is generated for every pixel ie p(i,j)
finally i should have a polynomial for every s pixel
Walter Roberson
Walter Roberson el 24 de Nov. de 2012
Your "text" is a matrix. When is the second row of the matrix used?
Matt Fig
Matt Fig el 24 de Nov. de 2012
Editada: Matt Fig el 24 de Nov. de 2012
Yet still you don't reveal the general pattern....
P(m,n) = _________________________
(for m = 1:size(s,1) and n = 1:size(s,2) ????)
Fill in the blank and clarify the ranges.
Sharen H
Sharen H el 24 de Nov. de 2012
okok i am not knowing how to explain please
i have a secret matrix s= [2 1 ; 3 4]
similarly a text matrix t=[2 3 4 ; 5 6 7,5 6 7] it can be any size
i have to combine this and generate a polynomial p which should have the same size of s
polynomial chooses values based on the threshold if threshold is 3 one value from s and others from text always only one from s matrix
ie p=
[s(1,1)+t(1,1)*x^1+t(1,2)*x^2 s(1,2)+t(1,3)*x^1+t(2,1)*x^2
[s(2,1)+t(2,2)*x^1+t(2,3)*x^2 s(2,2)+t(3,1)*x^1+t(3,2)*x^2 ]
when i substitute for x it becomes a matrix p. the remaining values of text can be left without
processing
am i clear thanks a lot for helping
Sharen H
Sharen H el 24 de Nov. de 2012
Degree of the polynomial should be threshold-1
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
It's still not clear for me, what does that mean
s(1,2)+t(1,3)*x^1+t(2,1)*x^2
Sharen H
Sharen H el 24 de Nov. de 2012
Editada: Sharen H el 24 de Nov. de 2012
first digit of the polynomial is from the s matrix and other two digits from text matrix
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
for s it's clear, how are using t?
Sharen H
Sharen H el 24 de Nov. de 2012
if threshold is 3 for s(1,1) i take first two values from t, then for s(1,2) the next two values from t matrix it goes like that ..
if threshold is 4 i have to take 3 values from t matrix
Walter Roberson
Walter Roberson el 24 de Nov. de 2012
So if your threshold is N, you take N-1 consecutive entries from t, proceeding along columns, and "wrapping" along to the next row ?
Sharen H
Sharen H el 24 de Nov. de 2012
Editada: Sharen H el 24 de Nov. de 2012
yes
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
Editada: Azzi Abdelmalek el 24 de Nov. de 2012
Then why t(2,1) is repeated?

Iniciar sesión para comentar.

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
Editada: Azzi Abdelmalek el 24 de Nov. de 2012

1 voto

s=[2 3 ;4 5]
text = [2 3 4; 5 6 7; 4 5 6]
t=text.'
t=t(:)
th=3;
x=11
[n,m]=size(s)
c=1:th-1;
idx1=1;
idx2=th-1;
for k=1:n
for l=1:m
t1=t(idx1:idx2).'
P(k,l)=s(k,l)+sum(t1.*x.^c)
idx1=idx1+th-1
idx2=idx2+th-1
end
end

3 comentarios

Walter Roberson
Walter Roberson el 24 de Nov. de 2012
Minor correction: use .' instead of ' as in theory t could contain complex numbers.
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
Ok Walter, It's done
Sharen H
Sharen H el 25 de Nov. de 2012
thanks a lot ....It works perfectly

Iniciar sesión para comentar.

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
Editada: Azzi Abdelmalek el 24 de Nov. de 2012

0 votos

s=[2 3 ;4 5]
text = [3 5 6 7 3 4 5 6]
threshold=4;
x=11
c=1:threshold-1
P=s(1,1)+sum(text(c).*x.^c)

2 comentarios

Sharen H
Sharen H el 24 de Nov. de 2012
the value of text should be incremented for s(1,2)
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Nov. de 2012
If threshold=3 what should be the result?

Iniciar sesión para comentar.

Matt Fig
Matt Fig el 24 de Nov. de 2012

0 votos

Sharen, please fill in the blank and define the ranges:
P(m,n) = _________________________
(for m = 1:size(s,1) and n = 1:size(s,2)) <---- correct??

Categorías

Más información sobre Polynomials en Centro de ayuda y File Exchange.

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by