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.

1 次查看(过去 30 天)
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

回答(1 个)

Image Analyst
Image Analyst 2021-5-16
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.

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by