Solving a equation from excel.
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
dpb
2022-8-19
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!