Borrar filtros
Borrar filtros

how can I concatenate [aa,bb]?

2 visualizaciones (últimos 30 días)
Abhinandan Angadi
Abhinandan Angadi el 31 de Mayo de 2021
Comentada: Mathieu NOE el 31 de Mayo de 2021
clear all
close all
clc
x = linspace(1,50,25);
a = 100;
for n = 1:25
aa(1,1) = x(n).*9.81.*(a\x(n)).^2
if aa <= 50
disp('its valid')
elseif aa >= 51 && aa <= 75
disp('its valid but bigger')
else
disp('out of control')
end
end
y = linspace(1,100,25);
b = 200;
for m = 1:25
bb(1,1) = y(m).*9.81.*(a\y(m)).^2
if bb <= 50
disp('its valid')
elseif bb >= 51 && bb <= 75
disp('its valid but bigger')
else
disp('out of control')
end
end
for d = 1:25;
A(d) = [aa,bb]
end

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 31 de Mayo de 2021
hello
I believe there are a frew mistakes as aa and bb are not indexed in the for loops , so you have a scalar that will be overwritten at each for loop iteration
therefore I modified your code this way :
clear all
close all
clc
x = linspace(1,50,25);
a = 100;
for n = 1:25
% aa(1,1) = x(n).*9.81.*(a\x(n)).^2
aa(n) = x(n).*9.81.*(a\x(n)).^2;
if aa(n) <= 50
disp('its valid')
elseif aa(n) >= 51 && aa(n) <= 75
disp('its valid but bigger')
else
disp('out of control')
end
end
y = linspace(1,100,25);
b = 200;
for m = 1:25
% bb(1,1) = y(m).*9.81.*(a\y(m)).^2
bb(m) = y(m).*9.81.*(a\y(m)).^2;
if bb(m) <= 50
disp('its valid')
elseif bb(m) >= 51 && bb(m) <= 75
disp('its valid but bigger')
else
disp('out of control')
end
end
A = [aa' bb'];
  2 comentarios
Abhinandan Angadi
Abhinandan Angadi el 31 de Mayo de 2021
thanks for rectifying.
Mathieu NOE
Mathieu NOE el 31 de Mayo de 2021
you're welcome

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Google en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by