I'm trying to create a table using certain equations.
%V = voltage across nth resistor
%Resistor = value of nth resistor
%Requal = total sum of resistors
%VS = voltage source = 120 volts
VS=120
Resistor=[200,140,120,180,80,150,100];
Requal=sum(Resistor)
Vn=(Resistor/Requal)*VS;
%Vn = votage across nth resistor
Pn=Vn.^2./[Resistor]
%Pn=power dissipated in nth resistor
T=table(Resistor,Vn,Pn)
I so far have this however every time I run the program it gives me a 1x7 double under the columns. How do I get rid of the 1x7?

Respuestas (1)

Matt J
Matt J el 22 de Sept. de 2015
Editada: Matt J el 22 de Sept. de 2015

0 votos

Make Resistor a column vector instead of a row vector,
VS=120
Resistor=[200,140,120,180,80,150,100].'; %<---Column vector
...
T=table(Resistor,Vn,Pn)

Categorías

Más información sobre Dynamic System Models en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Sept. de 2015

Comentada:

el 22 de Sept. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by