I want to calculate Re for each diameter value but I get this error ''unable to perform assignment because the left and right sides have a different number of elements.''.how can I fix this ? Sorry, Im beginner in matlab.

2 views (last 30 days)
clear all clc
L=(2000+(5*50))
T=5+5*0.25
It=0.0075*L
ht=0.15*T
bt=0.50*It
e=0.0003*(5+50)
t=15000/sqrt(9.81/ht)
V=It*ht*bt
flwrt=V/t
D=0.1:0.01:0.5;
B=D'
iteration=1;
for D=0.1:0.01:0.5
v(iteration)=((4*flwrt)/(pi*D))
Re(iteration)=((v*D)/0.00000131)
iteration=iteration+1;
end

Answers (1)

Image Analyst
Image Analyst on 16 May 2021
Lots of errors in your code. Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
L=(2000+(5*50))
T=5+5*0.25
It=0.0075*L
ht=0.15*T
bt=0.50*It
e=0.0003*(5+50)
t=15000/sqrt(9.81/ht)
V=It*ht*bt
flwrt=V/t
D=0.1:0.01:0.5;
B=D'
for iteration = 1 : length(D)
thisD = D(iteration);
v(iteration) = (4*flwrt) / (pi*thisD)
Re(iteration) = (iteration * thisD) / 0.00000131;
end
plot(Re, 'b-', 'LineWidth', 2);
grid on
xlabel('Iteration', 'FontSize', fontSize);
ylabel('Re', 'FontSize', fontSize);
fprintf('Done running %s.m ...\n', mfilename);
% End of main script.

Categories

Find more on Startup and Shutdown 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!