Read Excel and write the output in same sheet in three columns
Afficher commentaires plus anciens
status = mkdir('D:\PK90'); cd D:\PK90
filename = 'sample.xlsx'; % path to your file, e.g., 'D:\PK79\Book1.xlsx'
% read the file to a table:
T = readtable(filename);
Q = 1; Da = 0.5; K = 0.1; G = 0.1; bt = 2; Pr = 2; Nb = 0.1; Nt = 0.1;
Le = 1; K1 = 0.01; a1 = 0.1; a2 = 0.1; % Rd = 0.75; A = 0.15; B = 0.15;
BC = @(ya,yb)[ ya(1); ya(2)-1; ya(5) + a1*(1-ya(4)); ya(7) + a2*(1-ya(6)); yb([2,4,6]); ];
ODE = @(x,y) [ y(2); y(3); (-y(1)*y(3) + y(2)^2 - Q*exp(-bt*x) + Da*y(2))/(1+K-K*G*y(3)^2);
y(5); ((-Pr*(Nb*y(5)*y(7) + y(1)*y(5) + Nt*y(5)^2)) - A*y(2) - B*y(4))/(1+(4*Rd)/3);
y(7); -Le*Pr*(y(1)*y(7) - K1*y(6)) - (Nt/Nb)*((-Pr*(Nb*y(5)*y(7) + y(1)*y(5) + Nt*y(5)^2)) - A*y(2) - B*y(4))/(1+(4*Rd)/3);];
xa = 0;xb = 6; x = linspace(xa,xb,100); solinit = bvpinit(x,[0 1 0 1 0 1 0]); sol = bvp5c(ODE,BC,solinit); S = deval(sol,x);
Cf = ( (1+K)*S(3,1) - ((K*G*S(3,1)^3)/3)); Nu = -(1 + (4*Rd)/3)*S(5,1); Sh = -S(7,1);
disp ([Cf Nu Sh])
writetable(T,filename,'WriteMode','overwritesheet')
% check the result:
T = readtable(filename)
%% I need to write the calculations of Cf, Nu and Sh in the sheet
Réponse acceptée
Plus de réponses (1)
Ayush Modi
le 14 Jan 2024
Hi Minati,
I ran the code and got the following error - Unrecognized function or variable 'A'.
Upon checking the code, I observed that the variable "A" is commented in the code.
Le = 1; K1 = 0.01; a1 = 0.1; a2 = 0.1; % Rd = 0.75; A = 0.15; B = 0.15; -- Original code
After correcting the code with the following changes, the code worked fine.
Le = 1; K1 = 0.01; a1 = 0.1; a2 = 0.1; Rd = 0.75; A = 0.15; B = 0.15;
Hope this helps!
1 commentaire
MINATI PATRA
le 15 Jan 2024
Catégories
En savoir plus sur Standard File Formats dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!