a simple calculation by each row
조회 수: 1 (최근 30일)
이전 댓글 표시
I have 11 variables with each 24 rows. Therefore the data has 24x11 matrix.
I need to find out a vector x that is unknown. It is calculated each row by each row.
I believe this is really a simple task, but it gives me an error message. Could you fix my code?
The csv data is attached.
The code is below:
opts = delimitedTextImportOptions("NumVariables", 11);
opts.DataLines = [2, Inf];
opts.Delimiter = ",";
opts.VariableNames = ["v1","v2","w1","w2","u1","u2","LL","L1","R","eta","vl"];
opts.SelectedVariableNames = ["v1","v2","w1","w2","u1","u2","LL","L1","R","eta","vl"];
opts.VariableTypes = ["double","double","double","double","double","double","double","double","double","double","double"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
tbl = readtable("https://de.mathworks.com/matlabcentral/answers/uploaded_files/1144220/data.csv", opts);
v1 = tbl.v1;
v2 = tbl.v2;
w1 = tbl.w1;
w2 = tbl.w2;
u1 = tbl.u1;
u2 = tbl.u2;
LL = tbl.LL;
L1 = tbl.L1;
R = tbl.R;
eta = tbl.eta;
vl = tbl.vl;
clear opts tbl
x = sym('x',[24 1]);
eqn= w1(1:24).^(1./eta(1:24)).*((v1(1:24)+vl(1:24).*(x-L1(1:24)))./(u1(1:24)))==w2(1:24).^(1./eta(1:24)).*((v2(1:24)-vl(1:24).*x)./(u2(1:24)))
solx = vpasolve(eqn,x)
댓글 수: 2
Jan
2022년 10월 3일
Whenever you mention an error message, post a copy of the complete message. It is easier to solve a problem than to guess, what the problem is ;-)
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!