Having this problem second time can anyone help?

1 visualizzazione (ultimi 30 giorni)
Demberel
Demberel il 16 Dic 2022
Modificato: Arif Hoq il 16 Dic 2022
a=[1.1];
b=[0.09];
x(1)=1.16; x(2)=1.32; x(3)=1.47; x(4)=1.65; x(5)=1.93;
for i=1:5
y(i)=(log(x.^2-1))./log(a.*x.^2-b);
end
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
y

Risposte (1)

Arif Hoq
Arif Hoq il 16 Dic 2022
Modificato: Arif Hoq il 16 Dic 2022
a=1.1;
b=0.09;
% x(1)=1.16;
% x(2)=1.32;
% x(3)=1.47;
% x(4)=1.65;
% x(5)=1.93;
x=[1.16;1.32;1.47;1.65;1.93];
% y=(log(x.^2-1))./log(a.*x.^2-b)
for i=1:size(x,1)
y(i)=(log(x(i).^2-1))./log(a.*x(i).^2-b);
end
y
y = 1×5
-3.2253 -0.4944 0.1804 0.5099 0.7221
%% without loop
a=1.1;
b=0.09;
x=[1.16;1.32;1.47;1.65;1.93];
y=log(x.^2-1)./log(a.*x.^2-b)
y = 5×1
-3.2253 -0.4944 0.1804 0.5099 0.7221

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by