필터 지우기
필터 지우기

How can I integrate equations, with arrays? I seem to get 1x1 sym instead of numbers!

조회 수: 2 (최근 30일)
Hello everyone, I am still a beginner in Matlab which is why I need some help with this. Up to the line calculating 'beta' I seem to be getting arrays with correct numbers, but after that, for 'Q', 'B' and 'C_n' I get "1x1 sym". How can I alter the code in order to get values for what I am trying to find?
A = pi*(0.01)^2;
p = 1/(A*0.4);
mass_shaft = 1;
rad_shaft = 0.01;
length_shaft = 0.4;
f = 'cos(x)*cosh(x)-1'; % function
r = [fzero(f,4.0) fzero(f,7.0) fzero(f,10.0) fzero(f,14.0)]; % roots
beta = r./length_shaft;
syms y
Q = (cos(beta.*y) + cosh(beta.*y) - ((cos(beta.*length_shaft) - ...
cosh(beta.*length_shaft))./(sin(beta.*length_shaft) - ...
sinh(beta.*length_shaft))).*(sin(beta.*y) + sinh(beta.*y)))^2;
B = int(Q,y,0,length_shaft);
C_n = (B.*A*p)^(-0.5);

채택된 답변

madhan ravi
madhan ravi 2019년 5월 8일
double() to get the results as decimal values
  댓글 수: 2
Zeyad Elsayed
Zeyad Elsayed 2019년 5월 8일
Hi Madhan,
I got 4 errors as shown below, and now in the 'Workspace' section I cant see 'Q', 'B' and 'C_n'. Could there be a problem with the way im defining the equations Q, B and C_n? Or in the way im declaring 'y' as a variable?
Error using symengine
Not a square matrix.
Error in sym/privBinaryOp (line 1002)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in ^ (line 325)
B = privBinaryOp(A, p, 'symobj::mpower');
Error in Roots (line 13)
Q = double((cos(beta.*y) + cosh(beta.*y) - ((cos(beta.*length_shaft) - ...

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by