a simple calculation by each row
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Deokjae Jeong
am 3 Okt. 2022
Bearbeitet: Torsten
am 3 Okt. 2022
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 Kommentare
Jan
am 3 Okt. 2022
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 ;-)
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!