hi I'm trying yo divide two arrays using the decent, i know it uses polynomial division and how it works but i wrote this function as a test to see whether it worked and i only get one answer and that the quotient... why is there no remainder when there should be? have i written it wrong?
function [q,r] = arraydiv(c,u)
[q,r] = deconv(c,u);
end
i have c=[1,5] and u=[1,2] (just a simple example) so when i try to use the function all i get is ans =1 but there should be a remainder? and shouldn't it say q=1 r=3?
thankyou I'm sure I'm just doing something stupid

 채택된 답변

Mischa Kim
Mischa Kim 2014년 10월 21일
편집: Mischa Kim 2014년 10월 21일

0 개 추천

Zoe, you need to call the function the same way it is defined. In other words, use
c = [1,5];
u = [1,2];
[q,r] = arraydiv(c,u)
q =
1
r =
0 3
I assume you used
arraydiv(c,u)
ans =
1

추가 답변 (1개)

Zoe Palmer
Zoe Palmer 2014년 10월 21일

0 개 추천

Knew i was doing something stupid. i was typing in arraydiv(c,u) Thankyou :)

카테고리

도움말 센터File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

질문:

2014년 10월 21일

편집:

2014년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by