solving an equation and adding results to a matrix

조회 수: 3(최근 30일)
Berk Artkiy
Berk Artkiy 2021년 11월 24일
댓글: VBBV 2021년 11월 25일
syms m;
syms n;
k=linspace(-3.5,+0.5);
z=zeros(1,100);
c=length(k);
for s=1:1:100
z(s)=solve((k(s)+1.5).^2+(m-0.75).^2==4,m);
end
I want to solve this equation for every value of k, but i can not add the result of solve function into elements of z matrix.
Unable to perform assignment because the left and right sides have a different number of elements.
Error in dneme (line 7)
z(s)=solve((k(s)+1.5).^2+(m-0.75).^2==4,m);
It gives the error above.

채택된 답변

VBBV
VBBV 2021년 11월 25일
syms m;
syms n;
k=linspace(-3.5,+0.5);
z=zeros(1,100);
c=length(k);
for s=1:1:100
z =solve((k(s)+1.5).^2+(m-0.75).^2==4,m);
zz(:,s) = z;
end
zz
zz = 
  댓글 수: 2
VBBV
VBBV 2021년 11월 25일
Thanks is accepting answer :)

댓글을 달려면 로그인하십시오.

추가 답변(0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by