# How i can find the difference between 2 values.

조회 수: 3(최근 30일)
myrto pieridou 2022년 7월 18일
편집: Jon 2022년 7월 20일
I have 2 tables, with 1 column and 24 rows each.
I want to find the diferrence between each value in every row.
for example
T1=[1.5
2.5
3.5
4.5]
T2=[1.2
2
3
4]
Diff=[ 0.3
0.5
0.5
0.5]

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

### 답변(2개)

Jon 2022년 7월 18일
y = T1 - T2
##### 댓글 수: 9표시숨기기 이전 댓글 수: 8
Jon 2022년 7월 20일
편집: Jon 2022년 7월 20일
Glad you got this sorted out. If this answered your question please accept the answer. Thanks @Stephen23 for pressing through the details on this and helping the OP understand.

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

Torsten 2022년 7월 18일
T1=[1.5
2.5
3.5
4.5];
T2=[1.2
2
3
4];
Difference = T1 - T2
Difference = 4×1
0.3000 0.5000 0.5000 0.5000
##### 댓글 수: 1표시숨기기 없음
myrto pieridou 2022년 7월 18일
i already did this but the answer is different. I will upload my code to see it.
clear all
define_constants;
Unrecognized function or variable 'define_constants'.
demand=[1775.835,1669.815,1590.3,1563.795,1563.795,1590.3,1961.37,2279.43,2517.975,2544.48,2544.48,2517.975,2517.975,2517.975,2464.965,2464.965,2623.995,2650.5,2650.5,2544.48,2411.955,2199.915,1934.865,1669.815]
time=[1:1:24];
voltage1=[1.0350;1.0350;0.9917;0.9997;1.0201;1.0154;1.0250;0.9947;1.0029;1.0308;0.9915;1.0052;1.0200;0.9800;1.0140;1.0170;1.0384;1.0500;1.0235;1.0387;1.0500;1.0500;1.0500;0.9790;];
for i=1:1:24
end
for i=1:1:24
if i==19
mpc.gen([3],BR_STATUS)=0;
mpc.branch([3],BR_STATUS)=0;
end
normal(i)=runpf(mpc)
end
voltage=normal(19).bus(:,VM)
Difference = voltage1 - voltage

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

### 범주

Find more on Simscape Electrical in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by