フィルターのクリア

trrapz function not working in matlab R2023b, how can I fix this?

2 ビュー (過去 30 日間)
Pavlova Orozco Corona
Pavlova Orozco Corona 2024 年 3 月 2 日
コメント済み: VBBV 2024 年 3 月 2 日
clear
clc
close all
table = readtable("B737lift_drag.xlsx");
x = table(:, 1);
lift = table (:, 2);
drag = table(:, 3);
totalA = trapz(x,lift);
V(1) = totalA;
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2024 年 3 月 2 日
編集済み: Dyuman Joshi 2024 年 3 月 2 日
How exactly is it "not working"?
Edit - Ah yes, you need to extract data from the table.

サインインしてコメントする。

回答 (2 件)

VBBV
VBBV 2024 年 3 月 2 日
編集済み: VBBV 2024 年 3 月 2 日
totalA = trapz(x,lift,1);
  2 件のコメント
VBBV
VBBV 2024 年 3 月 2 日
specify the dimension to integrate
VBBV
VBBV 2024 年 3 月 2 日
table = readmatrix("B737lift_drag.xlsx");
Use readmatrix in place of readtable

サインインしてコメントする。


Hassaan
Hassaan 2024 年 3 月 2 日
clear
clc
close all
table = readtable("B737lift_drag.xlsx");
x = table{:, 1}; % Convert table column to numeric array
lift = table{:, 2}; % Convert table column to numeric array
% No need to convert 'drag' as it's not used in the following line
totalA = trapz(x, lift); % Ensure x and lift are numeric arrays
V(1) = totalA;
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by