Small(I think) Matlab coding question.

<p>I’m figuring someone on this board knows how to do this. </p>

<p>I’m trying to write code to solve an infinite series and getting hung up with the solver. Basically I want to take a variable I defined earlier, construct a single variable equation with it, then solve for the variable. But as far as I can see, the solver only accepts strings like:</p>

<br>

<br>

<p>but</p>

<br>

<br>

<p>doesn’t work.</p>

<p>What I’m trying to do is write to do is solve the series iteratively, by solving with n terms, then n+1 terms, comparing the solutions and seeing if the difference is negligible, so I have to rebuild the equation each time. But to do this, I need to use previously defined code that calculate what the n,n+1, n+2 terms are.</p>

<p>I think this is just me not knowing some basic process in Matlab. If anyone can clue me in on how to use previously defined variables, or another way to write the code, I’d appreciate it.</p>

<p>try:
[X,Y] = solve(‘y=3’,‘x-y=4’)</p>

<p>(this way you’re solving a system of equations where one equation is y = 3 and the other one is x - y = 4 and then you get back the values for x and y.</p>

<p>Perhaps my example was too simple. The y in my case is not predefined. Basically this first part of my code finds an array of y values, which are the n=1,2,3… solutions of the infinite series coefficients. Then, I plug these in the equation and solve for the x.</p>

<p>The problem’s essentially that y can’t be predefined, and I need a way to solve for x using what I get for y as the input.</p>

<p>kinda OT, but how often is MATLAB used in the real world of engineering?</p>