Solve through an array

조회 수: 12 (최근 30일)
Kevin Edlebeck
Kevin Edlebeck 2018년 1월 22일
편집: Birdman 2018년 1월 22일
I have an array of 4 different values that I am trying to put in an equation and solve for that variable for each value, which would create another array of my 4 values of the solutions. How can I do this, here is what I have so far.
%USING EQUATIONS TO FIND DAMPENED NATURAL FREQUENCY
n=4;
d=(1/n)*log(rdivide(yn,ynplusone));
syms t
zeta=d==((2*3.14159*t)/(sqrt(1-(t.^2))))
solx=solve(zeta,t)
d is my 1 x 4 array and I need solx to also be a 1 x 4 array with the solutions to the equation zeta.

채택된 답변

Birdman
Birdman 2018년 1월 22일
Replace
syms t
zeta=d==((2*3.14159*t)/(sqrt(1-(t.^2))))
with
t=sym('t',[1 4]);
zeta=d==((2*3.14159.*t)./(sqrt(1-(t.^2))))
respectively.
  댓글 수: 2
Kevin Edlebeck
Kevin Edlebeck 2018년 1월 22일
So now I get a 1 x 4 sym, I can't see the values for them? Is this a working array that I can use for further calculation? Here is what it outputted
solx =
struct with fields:
t1: [1×1 sym]
t2: [1×1 sym]
t3: [1×1 sym]
t4: [1×1 sym]
Birdman
Birdman 2018년 1월 22일
편집: Birdman 2018년 1월 22일
Type
solx.t1
solx.t2
and so on for other fields.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by