function solve return 'Unable to perform assignment because the left and right sides have a different number of elements.'
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
KSSV
2022년 1월 21일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!