Clear Filters
Clear Filters

Excel Data in Matlab

1 view (last 30 days)
Maduka
Maduka on 18 Dec 2022
Commented: Maduka on 19 Dec 2022
I want to replicate this graph of Grashof number at various velocity at different temperature, but I’m having challenge doing this on Matlab, please any assistance

Accepted Answer

KSSV
KSSV on 18 Dec 2022
Read about readtable. Using this import data from excel to MATLAB workspace and than use plot.
  6 Comments
Maduka
Maduka on 19 Dec 2022
Gr = 5:5:25; % vectors are orthogonal, allowing implicit expansion to 2D t = (0.2:0.2:1).'; H = 1; n = 1; N = 5; Pr = 0.72; S = 0.2;
% pull out common terms B = Pr*(N-n);
% pull out term blocks % note that the terms of TB1 begin with an imbalanced (Pr*(N-n)^k, so it's unclear what that means % i'm going to assume that means (Pr*(N-n))^k, not Pr*(N-n)^k TB1 = t.^2/2 ... + B*(t.^4/24 - t.^2/4) ... + B^2*(t.^6/720 - t.^4/48 + 5*t.^2/48)... % 5*t^2/48 + B^3*(t.^8/40320 - t.^6/1440 + 5*t.^4/576 - 61*t.^2/1440) ... + B^4*(t.^10/36288000 - t.^8/80640 + 5*t.^6/17280 - 61*t.^4/17280 + 1385*t.^2/806400) - 1/2 ... + B*5/24 ... - B^2*61/720 ... + B^3*277/8064 ... - B^4*(0.014);
TB2 = t.^4/24 ... % + not + B.(t.^6/720 - t.^4/48) ... + B^2*(t.^8/40320 - t.^6/1440 + 5*t.^4/576)... + B^3*(t.^10/32688000 - t.^8/80640 + 5*t.^6/17280 - 61*t.^4/17280) ... + B^4*(t.^12/479001600 - t.^10/7257600 + 5*t.^8/967680 - 61*t.^6/518400 + 1385*t.^4/967680) - t.^2/4 ... + B*5*t.^2/48 ... - B^2*61*t.^2/1440 ... + B^3*277*t.^2/16128 ... - B^4*(7*t.^2/1000);
TB3 = 1/24 ... + B*(1/720 - 1/48) ... + B^2*(1/40320 - 1/1440 + 5/576) ... + B^3*(1/36288000 - 1/80640 + 5/17280 - 61/17280) ... + B^4*(1/479001600 - 1/7257600 + 5/967680 - 61/518400 + 1385/967680) - 1/4 ... + B*5/48 ... - B^2*61/1440 ... + B^3*277/16128 ... - B^4*7/100;
U = -Gr.*TB1 - (S + H - n)*Gr.*(TB2 - TB3); % elementwise multiply
% plot everything figure contourf(Gr,t,U) colorbar figure; hp = plot(t,U,'-d'); lstr = cell(numel(Gr),1); for k = 1:numel(Gr) lstr{k} = sprintf('Gr = %d',Gr(k)); end legend(hp,lstr,'location','southwest')
Now I’m trying to generate same curved graph with this code
Maduka
Maduka on 19 Dec 2022
If it’s possible to plot without the code, using table values… I’ll appreciate

Sign in to comment.

More Answers (0)

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!