필터 지우기
필터 지우기

plot 1st order bessel derivative

조회 수: 5 (최근 30일)
zamri
zamri 2012년 7월 31일
댓글: Md Rezaul Karim 2020년 4월 19일
Hi all,
Can i ask if somebody can help me on why i got 'matrix dimension don't agree' thereby cannot get a plot for first order bessel derivative.
If i type 'diff(besselj(1,z),z)', i'd get 'besselj(0, z) - besselj(1, z)/z'
but then when i want to plot 'besselj(0, z) - besselj(1, z)/z' by typing:
format long
z = (0:1:100)';
a=besselj(0, z) - besselj(1, z)/z;
plot(z,a)
it'd give error as below:
??? Error using ==> minus
Matrix dimensions must agree.
Error in ==> Untitled at 4
a=besselj(0, z) - besselj(1, z)/z;
for some reason the second term gives 101x101 dimension which doesnt agree with the first term (101x1).

채택된 답변

Matt Kindig
Matt Kindig 2012년 7월 31일
I think you need to use element-wise division with the z:
a=besselj(0, z) - besselj(1, z)./z;
  댓글 수: 1
Md Rezaul Karim
Md Rezaul Karim 2020년 4월 19일
yes. cheack elementwise div or mul

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 7월 31일
besselj(1, z)/z is using the mrdivide operator ("/"), and so is the least-squares solution to X*z = besselj(1, z) . This will not be a vector.
If you want to construct the list of [besselj(1,K) / K] for K in 0 : 100, then you should use the rdivide arithmetic divide operator rather than the matrix divide operator:
besselj(1, z) ./ z
  댓글 수: 1
zamri
zamri 2012년 8월 1일
thanks Walter, u're brilliant.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by