how to perform a vectorized operation with an array of multiple random numbers?

1 view (last 30 days)
I want to perform multiple vectorized operations with the following numbers:
v_tank = 10.*rand(100,1)+35;
The code is:
clear all; close all; clc;
hold on
v_tank = 10.*rand(10,1)+35;
v_trailertank = 80;
v_trailer = 100;
t_loading = 1/12;
t_unloading = 1/12;
L = 400;
%the vector operations:
x = 100:0.01:150;
t_tank1=(t_loading+(x/v_trailertank)+t_unloading)+((L-x)/v_tank);
t_tank2=(t_loading+(x/v_trailertank)+t_unloading)+x/v_trailer+(t_loading+L/(v_trailertank)+t_unloading);
t_operation=max(t_tank1,t_tank2);
It can be seen that v_tank in the operation is an array of 100 random numbers. I want the vectorized operation be executed for all values of v_tank. I was thinking about a for-loop, but is impossible because v_tank are not positive integers. Please help.

Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!