a simple calculation by each row
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Jan
le 3 Oct 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 ;-)
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Equation Solving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!