Incompatible Array Size/Mathematical Input Error
1 view (last 30 days)
Show older comments
I was trying to get the "exact" function to work its rather long though, and I've typed it all out below in MATLAB.
For the exact equation I really don't know how I shoud even input the summation, since I've never worked with one like that before, so I suspect I've done that wrong or maybe I misinterperated the instuctions? But If anyone sees what I've done wrong I'd really appriciate it.
So far, I've typed everything in as follows:
clear;clc
x = 3.*[8 7 4];
V = [8 7 4];
R = [8 7 4];
Eo = V./(2.*R);
r = ((2.*R) + x)./(2.*R);
B = acosh(r);
n = 1:100;
S = x./(2.*R);
f = ((1./sinh(2.*n.*B)).*(1+r+(sinh(B).*((coth(2.*n.*B))))./(1-r-(sinh(B).*(coth(2.*n.*B)))).^2)+(cosh(2.*B))+r+(((2.*r)+1).*(sinh(B).*((coth(2.*n.*B)))))./(((cosh(2.*B))-r-(((2.*r)-1).*(sinh(B).*((coth(2.*n.*B)))))).^2));
E_max_simp = (Eo./4.*S).*(1+(2.*S)+sqrt((1+(2.*S)).^2)+8);
E_max_exac = Eo(1+((2.*r+1)/(2.*r-1)^2))+sinh(B).*syssum(f,n,1,inf);
0 Comments
Answers (1)
Walter Roberson
on 20 Sep 2022
x = 3.*[8 7 4];
V = [8 7 4];
R = [8 7 4];
Eo = V./(2.*R);
r = ((2.*R) + x)./(2.*R);
B = acosh(r);
syms m n integer
S = x./(2.*R);
E_max_simp = (Eo./4.*S).*(1+(2.*S)+sqrt((1+(2.*S)).^2)+8)
f = ((1./sinh(2.*n.*B)).*(1+r+(sinh(B).*((coth(2.*n.*B))))./(1-r-(sinh(B).*(coth(2.*n.*B)))).^2)+(cosh(2.*B))+r+(((2.*r)+1).*(sinh(B).*((coth(2.*n.*B)))))./(((cosh(2.*B))-r-(((2.*r)-1).*(sinh(B).*((coth(2.*n.*B)))))).^2));
E_max_exac = Eo .* (1+((2.*r+1)/(2.*r-1).^2))+sinh(B).*symsum(f,n,1,m);
E_max_exac_100 = vpa(subs(E_max_exac, m, 100))
Notice that your E_max_simp is constant. Notice that your Eo is a vector that has all entries work out to exactly 1/2, and notice that your E_max_simp does not involve n or any sum.. everything happens to cancel out leaving constants.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!