フィルターのクリア

How perform Kinetic energy summation having matrix and vector

2 ビュー (過去 30 日間)
Giovanni Curiazio
Giovanni Curiazio 2022 年 11 月 6 日
回答済み: Morgan 2022 年 11 月 6 日
How i could calculate the following kinetic energy:
N=100
The importan thing is that:
m is a vector [N,1]
V0 is a vector [1,3]
DeltaV_c is a matrix [N,3]

回答 (1 件)

Morgan
Morgan 2022 年 11 月 6 日
So kinetic energy must always be a scalar quantity, i.e. m is a scalar, velocity is a vector but by squaring it you're finding magnitude squared which is a scalar. Making some assumptions about your question I've made a function that should help you
function KE = kineticEnergy(m,V0,DeltaV_c)
% KINETICENERGY A function that takes mass (m) data
% and velocity data (V0 & DeltaV_c) to
% calculate total kinetic energy.
%
% Example usage: KE = KINETICENERGY(m,V0,DeltaV_c);
%
% INPUT ARGUMENTS
% ================
% m Mass data (size: [N,1])
% V0 Initial? velocity data (size: [1,3])
% DeltaV_c Changed? velocity data (size: [N,3])
%
% OUTPUT ARGUMENTS
% ================
% KE Total kinetic energy
KE = 0.5*sum(m.*norm(V0+DeltaV_c).^2);
end
I've also created a demo file to test that the function works with random data points:
% demo_kineticEnergy.m
% Initialize MATLAB
clear variables
close all
clc
% Create Random Data Arrays
N = 100;
m = rand(N,1);
V0 = rand(1,3);
DeltaV_c = rand(N,3);
% Call kineticEnergy.m
KE = kineticEnergy(m,V0,DeltaV_c);
Hopefully this helps, let me know if some assumptions I've made about your problem are incorrect.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by