Integrating double array to cell array
3 ビュー (過去 30 日間)
古いコメントを表示
Hi everybody, i'm trying to integrate/put in a double array of the size 16x16 to a cell array with the size 16x16. For example i want the value of the double array from (1,1) in the cell array on {1,1}.speed. Further down is my code so far. In the last lines i extract data from the cell array to a double array. What i want to do is to tourn this around, integrate the top_plate_speed into the top_plate cell array. After this i want to have in every element of the cell array the values of position_x, position_y and speed.
Code:
radius_bottom = 0.125; %[m]
speed_bottom = 200; %[U/min]
position_upper_x = 0; %[m]
position_upper_y = 0; %[m]
square_length_upper = 0.06; %[m]
speed_top = 100; %[1/min]
contourf_accuracy = 10; %Number of different fields in the figure
%%Convert Parameters
speed_bottom = speed_bottom/60; %convert from [U/min] to [U/sec]
speed_top = speed_top/60; %convert from [U/min] to [U/sec]
%%Calculation
top_plate = cell(accurancy*square_length_upper+1,accurancy*square_length_upper+1);
for run_y = 1:size(top_plate,1)
for run_x = 1:size(top_plate,2)
top_plate{run_y,run_x}.position_x = (-(size(top_plate,2)-((size(top_plate,2)-1)/2))+run_x)/accurancy;
top_plate{run_y,run_x}.position_y = ((size(top_plate,1)-((size(top_plate,2)-1)/2))-run_y)/accurancy;
end
end
top_plate_speed_x = cellfun(@(x) x.position_x,top_plate);
top_plate_speed_y = cellfun(@(x) x.position_y,top_plate);
top_plate_speed = 2*pi*speed_top*sqrt(top_plate_speed_x.^2+top_plate_speed_y.^2);
I hope i described it understandable. Thanks in advance
0 件のコメント
採用された回答
Star Strider
2017 年 6 月 14 日
I cannot run your code, since I do not have all your variables.
2 件のコメント
Star Strider
2017 年 6 月 16 日
‘I want to integrate the double array top_plate_speed to the cell top_plate.’
What do you intend by ‘integrate’? If you want to do numerical integration, use the trapz (previously quad) or similar functions.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!