function solve return 'Unable to perform assignment because the left and right sides have a different number of elements.'
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
trying to run this code where every parameter is known, only 'gamma' is my variable and 'hs_data' is a known function of 't_data'
hs_data = hs_Lderiv./1000; %meter
t_data = t; %seconds
dh = diff(hs_data);
dt = diff(t_data);
syms gamma
dhdt = zeros(size(t_data)-1);
gammaL = zeros(size(hs_data)-1);
gammaH = zeros(size(hs_data)-1);
for n = 1:length(t_data)-1
dhdt(n)= dh(n)./dt(n);
gammaL(n) = solve(dhdt(n) == -(1.2269.*gamma.*a_channel.^7.*hs_data(n).^4)./(pi().*mu.*L.*(a_source.^2+hs_data(n).^2).^5), gamma);
gammaH(n) = solve(dhdt(n) == -((2.*gamma)./(26.08.*pi().*mu.*a_channel.*L.*(a_source.^2+hs_data(n).^2))).*((((2.*a_channel.^2.*hs_data(n))./(a_source.^2+hs_data(n).^2))-((dRho.*g.*a_channel.^2.*hs_data(n))./(2.*gamma))).^4), gamma);
end
the first function 'solve' (the one returnin 'gammaL') works perfectly but the second one always returns the error 'Unable to perform assignment because the left and right sides have a different number of elements.'
is there a very trivial error i cannot find?
thank you very much in advance
0 Kommentare
Antworten (1)
KSSV
am 21 Jan. 2022
hs_data = hs_Lderiv./1000; %meter
t_data = t; %seconds
dh = diff(hs_data);
dt = diff(t_data);
syms gamma
dhdt = zeros(size(t_data)-1);
gammaL = cell(size(hs_data)-1,1);
gammaH = cell(size(hs_data)-1,1);
for n = 1:length(t_data)-1
dhdt(n)= dh(n)./dt(n);
gammaL{n} = solve(dhdt(n) == -(1.2269.*gamma.*a_channel.^7.*hs_data(n).^4)./(pi().*mu.*L.*(a_source.^2+hs_data(n).^2).^5), gamma);
gammaH{n} = solve(dhdt(n) == -((2.*gamma)./(26.08.*pi().*mu.*a_channel.*L.*(a_source.^2+hs_data(n).^2))).*((((2.*a_channel.^2.*hs_data(n))./(a_source.^2+hs_data(n).^2))-((dRho.*g.*a_channel.^2.*hs_data(n))./(2.*gamma))).^4), gamma);
end
2 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!