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.

3 ビュー (過去 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 Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by