solving an equation and adding results to a matrix

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

VBBV
VBBV il 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 = 

Più risposte (0)

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by