Effacer les filtres
Effacer les filtres

how to generate a polynomial

7 vues (au cours des 30 derniers jours)
Sharen H
Sharen H le 24 Nov 2012
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 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 24 Nov 2012
Modifié(e) : Azzi Abdelmalek le 24 Nov 2012
Then why t(2,1) is repeated?
Walter Roberson
Walter Roberson le 24 Nov 2012

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 24 Nov 2012
Modifié(e) : Azzi Abdelmalek le 24 Nov 2012
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 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 24 Nov 2012
Ok Walter, It's done
Sharen H
Sharen H le 25 Nov 2012
thanks a lot ....It works perfectly

Connectez-vous pour commenter.

Plus de réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 24 Nov 2012
Modifié(e) : Azzi Abdelmalek le 24 Nov 2012
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 commentaires
Sharen H
Sharen H le 24 Nov 2012
the value of text should be incremented for s(1,2)
Azzi Abdelmalek
Azzi Abdelmalek le 24 Nov 2012
If threshold=3 what should be the result?

Connectez-vous pour commenter.


Matt Fig
Matt Fig le 24 Nov 2012
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??

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by