Having this problem second time can anyone help?

조회 수: 1 (최근 30일)
Demberel
Demberel 2022년 12월 16일
편집: Arif Hoq 2022년 12월 16일
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

답변 (1개)

Arif Hoq
Arif Hoq 2022년 12월 16일
편집: Arif Hoq 2022년 12월 16일
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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by