Solving a equation from excel.

1 visualización (últimos 30 días)
Vishnuvardhan Naidu Tanga
Vishnuvardhan Naidu Tanga el 19 de Ag. de 2022
Comentada: Vishnuvardhan Naidu Tanga el 22 de Ag. de 2022
Hello everyone,
I am trying to solve a equation and integration from a excel data. But I am getting an error in solving the equation.
The equation is (according to excel namings): XD60^2+U_prime^2-{(V_prime^2+W_prime^2)/2}.
This equation i need to integrate. Can someone help me in solving this. I have tried using the following code is as follows
[num data raw] = xlsread('Matlab_trail.xlsx');
for i=1:size(num,2)
% Num{i} = num(:,i)(~isnan(num(:,i)));
Col = num(:,i);
Num{i} = Col(~isnan(Col));
end
A1 = pi*Num{1}.^2*1.225;
Q1 = A1.*Num{2}.^2;
Int1 = cumtrapz(A1, Num{2}.^2);
A2 = 2*pi*1.225*Num{3};
Q1 = Num{2}.^2+Num{4}.^2-{Num{6}.^2+Num{8}.^2}./2;
Int2 = cumtrapz(A2, Q1);
plot(Num{1}, Int1, 'linewidth', 2);
hold on
plot(num(:,1), Int2, 'linewidth', 2);
hold off

Respuesta aceptada

dpb
dpb el 19 de Ag. de 2022
Going at it hard way...first, just read the data as a table and can keep the variables as identified already...
>> tTrail=readtable('Matlab_trail.xlsx');
>> head(tTrail,3)
ans =
3×8 table
R XD60 XD U_prime XD_1 V_prime XD_2 W_prime
__________ ______ _________ _______ _________ _______ __________ _______
0 2.6909 0 0.24286 0.0015318 0.18446 0.00030059 0.18852
0.00038442 2.6851 0.0040551 0.24391 0.005111 0.18542 0.0038698 0.18833
0.0017053 2.6794 0.0076322 0.24468 0.0086903 0.18591 0.0074389 0.18858
>>
Then, use MATLAB vector syntax...
tTrail.Eqn=tTrail.XD60.^2+U_prime.^2-(V_prime.^2+W_prime.^2)/2;
Follow on with the next steps as you know the values you're trying to compute better than we can read the (nonworking) code.
NOTA BENE:
The expression
tTrail.XD60.^2+U_prime.^2
can also be written as
hypot(tTrail.XD60,U_prime).^2
  3 comentarios
dpb
dpb el 22 de Ag. de 2022
Editada: dpb el 22 de Ag. de 2022
What does the result of head(tTrail,3) like I showed above return? It worked as shown here with the sample file.
Post the code as you ran it and the error in context; SOMETHING is different, but we can't see what...
Vishnuvardhan Naidu Tanga
Vishnuvardhan Naidu Tanga el 22 de Ag. de 2022
Hello @dpb
i have found an other way to do the equation. Thank you for the help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by