From: Abe Linfrey on 27 May 2010 21:27 Hi all, I have coded the blasius solution for a flat plate in matlab using the shooting method with the guess of 0.332. Everything works. It displays the table for my interval from 0 to 7 along with respective ETA values. However, the interval is irregular, and now I have to go a step further to use the blasius solution and implement it in to the pohlhausen equation, which requires my values to be at regular interval. So I tried using the Matlab's interp1 function, but keep on getting error saying "X must be a vector." I have posted my code below. Any help will be appreciated. Thank you! Code: ti = 0.0; % start of integration tf = 7.0; % final value of integration tintval = [ti tf] % array of start and finish points delta = 0.1; guess1 = 0.0; guess2 = 0.0; guess3 = 0.33206; bcinit = [guess1 guess2 guess3]; % initial values [f ETA ] = ode45('state',tintval,bcinit); % ODE45 will look for state.m [f ETA] ETAFIT = [0:delta:7]; fFIT = interp1(ETA,f,ETAFIT,'spline'); % display in regular interval [fFIT ETAFIT] Code end the array [f ETA] displays fine, but [fFIT ETAFIT] won't work. Any ideas?
From: Abe Linfrey on 27 May 2010 22:45 "Abe Linfrey" <abe_cooldude(a)yahoo.com> wrote in message <htn65a$asb$1(a)fred.mathworks.com>... > Hi all, > > I have coded the blasius solution for a flat plate in matlab using the shooting method with the guess of 0.332. Everything works. It displays the table for my interval from 0 to 7 along with respective ETA values. However, the interval is irregular, and now I have to go a step further to use the blasius solution and implement it in to the pohlhausen equation, which requires my values to be at regular interval. So I tried using the Matlab's interp1 function, but keep on getting error saying "X must be a vector." I have posted my code below. Any help will be appreciated. > > Thank you! > > Code: > > ti = 0.0; % start of integration > tf = 7.0; % final value of integration > tintval = [ti tf] % array of start and finish points > delta = 0.1; > > guess1 = 0.0; > guess2 = 0.0; > guess3 = 0.33206; > > bcinit = [guess1 guess2 guess3]; % initial values > > [f ETA ] = ode45('state',tintval,bcinit); % ODE45 will look for state.m > > [f ETA] > > ETAFIT = [0:delta:7]; > fFIT = interp1(ETA,f,ETAFIT,'spline'); % display in regular interval > > [fFIT ETAFIT] > > Code end > > the array [f ETA] displays fine, but [fFIT ETAFIT] won't work. > > Any ideas? EDIT: I changed up the code a bit to match few graphs in the book, and here's the updated code. Now I am getting this error. ??? Error using ==> horzcat CAT arguments dimensions are not consistent. Error in ==> Blasius at 36 [ETAFIT,fFIT] UPDATED code: ti = 0.0; tf = 8.0; tintval = [ti tf] delta = 0.1; guess1 = 0.0; guess2 = 0.0; guess3 = 0.33206; bcinit = [guess1 guess2 guess3]; [ETA,f]=ode45('BlasiusFunc',tintval,bcinit); [ETA,f] ETAFIT = [0:delta:8]; fFIT = interp1(ETA,f,ETAFIT,'spline'); % display in regular interval [ETAFIT,fFIT] CODE END Here's a sample data from [ETA,f] ETA f f' f" 0 0 0 0.3321 0.0002 0.0000 0.0001 0.3321 0.0003 0.0000 0.0001 0.3321 0.0005 0.0000 0.0002 0.3321 0.0006 0.0000 0.0002 0.3321 0.0014 0.0000 0.0005 0.3321 0.0021 0.0000 0.0007 0.3321 0.0029 0.0000 0.0010 0.3321 0.0036 0.0000 0.0012 0.3321 0.0074 0.0000 0.0025 0.3321 0.0112 0.0000 0.0037 0.3321 0.0150 0.0000 0.0050 0.3321 0.0188 0.0001 0.0062 0.3321
From: Abe Linfrey on 27 May 2010 23:11 Here's my sizes of ETA and f Size of ETA = 77x1 Size of f = 77x3 So I am assuming I have to fix the sizes somehow. Anyone? I tried something like this, but nothing ETA1 = nan(numel(ETA),3); ETA1(1:numel(ETA),1) = ETA % [ETA1 f] ETAFIT = [0:delta:8]; fFIT = interp1(f,ETA1,ETAFIT,'spline'); % display in regular interval [ETAFIT,fFIT]
|
Pages: 1 Prev: random numbers Next: Using Solve to solve system of 2 eqns |