MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Light
on 8 Jun 2013

How can i give difference to number by '

S

S'

S''

And i will use it in next calculation.

U=S+1

U'=S'+2

P=S''+5 ....etc

But error message appeared

*No products are associated with this question.*

Answer by Matt J
on 8 Jun 2013

Edited by Matt J
on 8 Jun 2013

You haven't shown your error (or the code that generates it), so I have to guess what you are doing, but you cannot include non-alphanumeric characters other than underscores in the names of variables.

In any case, to solve a linear system of equations, you wouldn't define different variables. You would write the equations in matrix-vector form

A*x=b

and solve via

x=A\b

This is MATLAB, after all!

Light
on 8 Jun 2013

I'm a electrical engineering student. I need different variables.

dQ(max(negcolumn))=dx(max(negcolumn))*U(max(negcolumn)).^2*10.^-6; S'(max(negcolumn))=S(max(negcolumn))-dQ(max(negcolumn))*1i; S''(max(onerow))=S'(max(negcolumn))+S(max(onerow));

S is changed in everystep.

And S' is used in next step

dU01'=(real(S')*real(R01)+imag(S')*imag(R01))./U0/1000; dU01''=(real(S')*imag(R01)-imag(S')*real(R01))./U0/1000; U01t=sqrt((U0-dU01').^2+dU01''.^2);

If S S' S'' is only defined by S i can't get real S' value. Is it impossible in MATLAB??

Matt J
on 8 Jun 2013

None of what you said implies that S' has to have an apostrophe in its name. You could choose another name for it.

None of what you said that S and S' have to be separate variables, either. You could call them S(1) and S(2) instead, making them part of the same vector, S.

## 0 Comments