solving an equation and adding results to a matrix

1 view (last 30 days)
Berk Artkiy
Berk Artkiy on 24 Nov 2021
Commented: VBBV on 25 Nov 2021
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.

Accepted Answer

VBBV
VBBV on 25 Nov 2021
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 = 

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!