append data in the array using for loop
3 commentaires
What do you think of this logic @dpb % Set the failure criteria failure_criteria = 0.5; % Example value, modify as per your requirements
% Initialize variables i = 1; j_range = -90:1:90; % Range of j values from -90 to +90 degrees num_layers = [];
% Loop until the failure criteria are satisfied while isempty(num_layers) for j = j_range k = -j; % j = -k
% Check the failure condition
if checkFailureCondition(i, j, k, failure_criteria)
num_layers = i;
break;
end
end % If failure condition not satisfied, increment i and check again
if isempty(num_layers)
i = i + 1;
end
end% Display the minimal number of layers required disp(['Minimal number of layers required: ', num2str(num_layers)]);
% Function to check the failure condition function isFailed = checkFailureCondition(i, j, k, failure_criteria) % Calculate the failure condition based on i, j, k % Implement your own logic here % You can use the variables i, j, and k to calculate the failure condition % Return true if the condition is satisfied, false otherwise
% Example failure condition:
isFailed = abs(j - k) > failure_criteria;
endRéponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!