f



MatLab coding help needed for basic engineering problem

Hiya,
i've been trying to figure out a way to create a code to
differentiate, integerate and plot the results for a fluid mechanics
problem and would really appreciate any sort of help that i can get.

The problem's about volume-flow through a pump. What i'm meant to do
is make a GUI through GUIDE and have 3 m-files which can load data
from 2 excel files. the excel files contain 2 columns of Q(volume
flow) and time and numerous rows of values taken at different time
intervals. What i'm supposed to do is create three m-files to
determine:

a.	The change of volume flow with respect to time of the fluid in the
pump i.e dq/dt.

b.	The volume of fluid entering the hydraulic circuit
 /
|
| Q dt
|
/

(integrate Q with respect to t)

c.	A function file that determines the difference in the volume of
fluid in this system and a similar system without a leak, which means
the 2 data sets in the 2 excel files. they have been sampled at
different rates so i need to interpolate them as well.

And in the end, plot all a, b, and c with respect to time. The
problem is, i find the derivative of Q with respect to t throw
diff(q)./diff(t)...which ultimately caused the resulting dataset to
have one element less than q or t, and thus, i cant plot it against
t. how do i add another element to diff(q)./diff(t)? i tried using
size(dqdt) = [1001,1] => adding one more element to the set but it
doesnt accept it (dqdt is diff(q)./diff(t)).

What should i do? i believe this would be fairly basic stuff but i'm
a beginner and i would really appreciate some help.

Thanks,
Fahad.
0
4/8/2007 1:13:04 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
957 Views

Similar Articles

[PageSpeed] 30

Reply:

Similar Artilces:

Need help with some MATLAB coding problems
I have the following problems and no idea where to begin: 1) The function takes one string that contains two words separated by a space and returns true if the two words are identical (case sensitive).Otherwise, it should return false. Test Case: out1 = compareTwo('winner winner') out1 -> true 2) The function takes in a string which is a sentence of upper and lower case letters. The function then removes the upper case letters to reveal a secret message. The result should not contain any upper case letters. The result may contain lower case letters, spaces and numbers. Test Case: ...

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

urgent help needed: serial transmission from matlab to matlab
hi. really need help. i've to transmit an image serially between two computers using matlab on both transmitting and receiving ends. i've encoded the image into binary. been facing problems with the transmission when i used the command fprintf. when i executed that, i got a warning saying timeout occurred before terminator was reached. plus the receiving matlab hangs. i was told to save the binary packet into m-files then transmit the file over. how do i do that? is there a command to save and retrieve binary packets into and from m-files? i really need to get this done asap.thank you....

Re: need help,need fast adaptive QR-RLS algorithm matlab code!
i m from S.R.K.R. Engg. college from Andhra University. i need matlab code for QR-RLS algorithm please help me as quickly as possible regards, naresh hello friends, Do not be like stupids. Once it is your project that fetches some in your career, put some efforts to write code. For that, if you need help ask the guidenace from the Guru's. Before coming to this groups , search some thing in Google. Best Regards, Sathish Athreya "naresh" <ursnaresh_p@yahoo.co.in> wrote in message news:jjv4aws3xevn@legacy... > i m from S.R.K.R. Engg. college from Andhra Un...

Need matlab help
Hi, I am trying to solve an interesting problem. I have a handheld device that contains a basic 3d accelerometer. I am trying to determine the path that the device moves through the air and the timing associated with the device. Think of the device being moved like a tennis racket or golf club. Normally this would be a simple problem to solve as I have the acceleration data. THe complication is that the device swivels in the persons hand and so i do not really know which direction gravity is acting. I am trying to use Matlab to see if i can figure out the path or the timing (even just timi...

Matlab Problem, Need Help Urgent
Consider the integral ∫0 e-x sin(2x) dx ∏/4 a) Use the trapezoidal rule, and Simpson’s rule to approximate the integral. b) Compute the exact error in each case of part (a), and compare the exact error to the error bound associated for each integration method used. Hint: Use function s=simprl(f,a,b,M) %Input - f is the integrand input as a string 'f' % - a and b are upper and lower limits of integration % - M is the number of subintervals %Output - s is the simpson rule sum h=(b-a)/(2*M); s1=0; s2=0; for k=1:M x=a+h*(2*k-1); s1=s1+feval(f,x); e...

help needed with the matlab code inside
function q=getqmat(trial_mat,R) Q_matrix=zeros(20,1); Q_matrix_temp=zeros(20,20); Q_matrix_temp1=zeros(20,20); s=size(trial_mat,1); alpha=0.1; gamma=0.02; c=1; k=0; for k=s:-1:1 for i=1:20 for j=1:20 if((i==trial_mat(k,1))&&(j==trial_mat(k,2))) if(i==trial_mat(k,1)) Q_matrix_temp(i,j)=Q_matrix_temp(i,j)+ alpha *(R+ gamma *(Q_matrix(i-1+c,1)-Q_matrix_temp(i,j))) Q_matrix(i,1)=Q_matrix_temp(i,j) Q_matrix_temp1(i,j)=Q...

New to MATLAB. Need help with this problem.
I've just ignored this 3 problems (out of 9) in my final today and I wonder someone could help me to solve these problems so I can understand how to do it. 1/ Suppose we have a job that will take 20 hours to complete, and requires the use of a special (and expensive!) type of battery. It is known from exhaustive testing that the probability one of these batteries will wear out in (exactly) one hour is 0 .1, in two hours is 0.4, in three hours is 0.3 and in four hours is 0.2. For each 5 =< n =< 20 , let Pn denote the probability that exactly n batteries will be required to finish the job. Write a program that uses simulation to approximate the probabilities Pn . Perform a large number of simulated jobs, each time counting how many batteries were needed to complete the necessary 20 hours of work. Whenever a new battery is required, use a random number to determine how long it will last. Assume that as soon as a battery wears out, it is immediately replaced with a new one. Approximate each Pn as the fraction of trials when exactly n batteries were required to finish the job. 2/ The goal is to write a program that will determine whether or not a given number is prime. Let N and D be positive integers. D is called a divisor of N if there is a positive integer Q such that N = QD. An integer N >= 2 is called a prime number (or simply prime) if it has no divisors other than 1 and N itself. Equivalently, N is prime if it is not the product of two smaller po...

NEED Matlab help!!!! engineering class
I have assignment to do but I am having load of trouble doing anything. does anyone know the script for A periodic function with period 3 on the interval 0>=x<=3 given two function of x f(x)= { 2*sqrt(x) 0>= x =>1 { 3-x 1>= x =>3 please some one help me <edwardsimcox93@gmail.com> wrote in message news:da39d95d-5360-4cf2-a0be-cd6128ef8ee8@googlegroups.com... > I have assignment to do but I am having load of trouble doing anything. > > does anyone know the script for A periodic function with period 3 on the > interval 0>=x<=3 > > given two function of x > f(x)= { 2*sqrt(x) 0>= x =>1 > { 3-x 1>= x =>3 > please some one help me > In general, this newsgroup requires people posting homework questions (or questions that sound like homework) to show what they've tried to do to solve the question themselves and ask a SPECIFIC question. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

Need help running a matlab code
First off let me start off by saying I am not a programmer nor do I have any experience with programming. I want to run a matlab code but for some reason I dont think its doing what its suppose to and I get an error message. Message error: Error approximating the spectrogram (synthesis as in [1]): 177935.0959 Error approximating the spectrogram (synthesis as in [2]) (optimal): 171449.8023 Im trying to run a matlab program from this (http://mtg.upf.edu/static/mass/software/index.htm) website which is suppose to do source separation. When I load the "start_demo" 2 graphs load up but...

some problems of codes of MATLAB 7.0 working on MATLAB 6.5
I have used MATLAB for few hours.So I don't know the differences between version 6.5 and 7.0.I want to use some codes of MATLAB 7.0, but they doesn't work in MATLAB 6.5.How to change these codes so that they can work in matlab 6.5.Waiting for your help. Thank you . The codes are like this .I think changing the function findPI may work ,but I don'y know how % PIfun.m % Evaluate a function used to find the PI-line, using Kyle Champley's % method. % % Adam Wunderlich % last update: 5/18/06 function y = PIfun(r,R,h,gamma,x3,sb) temp = R - r*cos(gamma-sb); y = h*((pi - 2*atan(r*sin(gamma-sb)/temp))*(1 + (r^2 - R^2)/ (2*R*temp)) ... + sb) - x3; % find_PI_Line.m % % Find the the parametric interval corresponding to the unique PI-line % passing through the point x for a given helical pitch. % This code implements the method of Kyle Champley. % inputs: P = pitch (cm/turn), R = helix radius, delta_s = s stepsize, x % output: PI = [sb st] % % Adam Wunderlich % last update: 5/18/06 function [PI] = findPI(P,R,delta_s,x) h = P/(2*pi); r = sqrt(x(1)^2+x(2)^2); gamma = atan2(x(2),x(1)); options = optimset('TolX',h*delta_s/100,'FunValCheck','on'); [sb,fval,exitflag] = fzero(@(sb) PIfun(r,R,h,gamma,x(3),sb),... [(x(3)-h*pi)/h,x(3)/h],options); if exitflag ~=1, disp('Error: PI invalid'); end % note that beta=sb in Kyle's formula alphaX = atan(r*sin(gamma-sb)/(R - r*cos(gamma-sb))); st = sb + pi -...

problems with code to convert ncs file in matlab under Matlab R14(2004)
Hello to everyone, Ill try to run Nlx2MatCSC ( a code from neuralynx than convert continuous file to matlab variables) in Matlab R14 (2004), and it doesn't work: When I type: >> [Timestamp, ChanNum, SampleFrequency, NumValSamples, Samples] = Nlx2MatCSC(Filename, [1 1 1 1 1], 0, 3, [0 4 9]); ??? Attempt to execute SCRIPT Nlx2MatCSC as a function. I heard that this code is running in Matlab 2007a and newer, but...what about this old version? Any help, Cheers ...

Need help to use matlab code in vb...
Dear all, I am student and I have devlop one small module in matlab (.m file) but my other module is in vb so I want to add my matlab module in vb. So please guide me that how can I use matlab module in vb (or vb.net) Waiting for your kind,quick reply. Yours, Achyut You should look into the Matlab comtool which can compile your matlab functions into an COM dll which you then can call from your VB code ook in the MAtlab help under MATLAB COM builder Achyut wrote: > > > Dear all, > > I am student and I have devlop one small module in matlab (.m file) > but my other module...

need help with this matlab problem(NN tolbox)
hello everybody, i m currently trying to recognise diffrent shapes like triangles,circles, polygons etc. i hv 36x36 binary images. I m presently trying it with matlab toolbox. My network consists of 3 layers with 1296 neurons in the input and 144 in the hiddenn and 6 in the output layer. but when I tried to simulate the network with sim() function, i get this kind of error. ??? One or more output arguments not assigned during call to 'K:\Matlab\toolbox\nnet\nnet\@network\sim.m (simargs)'. Error in ==> network.sim at 183 case 2, [err,P,Pi,Ai,T,Q,TS,matrixForm] = simargs(net,P); but i don't get this error when data is not so large. and suggest me a better book or online material for neural network design. can someone help with this problem... thanking you , bye ramanjaneyulu What is simargs? I don't have one on v6.5. R13 SP1 Greg ...

need help for matlab -> c code
hi, short question.i'm using code composer studio for dsp and i need equivalent c code for matlab function length(). I need to find the length of an array in c e.g int x[5] = {1,2, 3, 4, 5}; int N = length(x); can anyone help? thanks pete Hi! I am not a very experienced c-programmer, but as far as I know, you will have to keep track of the array length in a separate variable. Alternatively, you can set the last value in the array to a specific number (maxint), and find the length by searching through the array for this number. Anyone else with a better suggestion? Best rega...

problems with PCI_6024E and DAQ under Matlab !!!! need HELP !!!!!
Hi all, Here is my problem: - I want to get signal from National Instrument DAQ card (PCI-6024E) under Matlab 6.1 with Data Acquisition Toolbox 2.1. - after pluging the card into the PC, I installed drivers downloaded from NI web site (drivers version 7.6). then under matlab, I typed the following lines to see if my card is detected: >> daqregister('nidaq') ans = 'mwnidaq.dll' successfully registered. >> daqinfo = daqhwinfo('nidaq') daqinfo = AdaptorDllName: 'C:\MATLAB6p1\toolbox\daq\daq\private\mwnidaq.dll' AdaptorDllVers...

New to MATLAB. Need help with this problem. #2
I've just ignored this 3 problems (out of 9) in my final today and I wonder someone could help me to solve these problems so I can understand how to do it. 1/ Suppose we have a job that will take 20 hours to complete, and requires the use of a special (and expensive!) type of battery. It is known from exhaustive testing that the probability one of these batteries will wear out in (exactly) one hour is 0 .1, in two hours is 0.4, in three hours is 0.3 and in four hours is 0.2. For each 5 =< n =< 20 , let Pn denote the probability that exactly n batteries will be required to finish the job. Write a program that uses simulation to approximate the probabilities Pn . Perform a large number of simulated jobs, each time counting how many batteries were needed to complete the necessary 20 hours of work. Whenever a new battery is required, use a random number to determine how long it will last. Assume that as soon as a battery wears out, it is immediately replaced with a new one. Approximate each Pn as the fraction of trials when exactly n batteries were required to finish the job. 2/ The goal is to write a program that will determine whether or not a given number is prime. Let N and D be positive integers. D is called a divisor of N if there is a positive integer Q such that N = QD. An integer N >= 2 is called a prime number (or simply prime) if it has no divisors other than 1 and N itself. Equivalently, N is prime if it is not the product of two smaller po...

MATLAB algorithm to MATLAB function code or C code
hallo firends, Can any body help me write this below code into MATLAB object oriented code or C code form please? M=50; % total number of periods. (choose for 1s duration) f0 = 50; % fundamental AC frequency T0 = 1/f0; %fundamental AC period T = M*T0; %Time for M periods (integer M) N=30; % sample points per period. dt = T0/N; % Sample at N points per period (integer N > 20) t = dt*[1:M*N-1]; % Sampling time array A0=120/2; % amplitude of AC signal. Divide by 2 or maybe sqrt (2) ? AC=A0*sin(f0*t*2*pi); % create AC signal. DC0=50; % DC amplitude DC=DC0*ones(1,length(t)); % create a DC signal that is constant of length t S=AC+DC; % total signal is AC signal + DC signal figure(1); plot(t,S); % plot signal. xlabel('time');ylabel('Signal'); title('Total Signal'); % filter components fAC=S-mean(S); % here is the AC component fDC=mean(S); % here is the DC component figure(2); plot(t,fAC,'r',t,fDC,'b'); % plot AC and DC signals legend('AC','DC'); xlabel('time');ylabel('Signal'); title('Signal with only AC component'); figure(3); plot(t,fDC,'b'); % plot DC signal legend('DC'); xlabel('time');ylabel('Signal'); title('Signal with only DC component'); figure(4); % best to plot in Fourier domain u=abs(fftshift(fft(S))); NumPoints=length(t); freq=(1/dt)*[1:NumPoints]/NumPoints; % create frequency axis freq=fre...

Calling Matlab functions in Fortran code
Hello, My work is on numerical techniques which require to solve sparse matrices etc. All my work is in fortran and I have almost no skill in Matlab.But I have just realized that Matlab can do some computations quite easily with its built-in functions and I want to take advantage of this. I have no time to learn Matlab deeply or work on matlab-fortran communication (very much off-focus issues and have deadline soon) Some details: I need to solve Ax=b system where A is very large and sparse matrix (20000x20000 or more). At every time step (iteration) I need to solve this system, get 'x...

need guidance on matlab coding for basic face detection
please provide useful links and guidence on how to write matlab code for face detection and tracking. my device source is webcam. ...

converting c++ code to Matlab code using Matlab 9
im working on a project using matlab. i want to use some of the already writen codes in C++. i want to use these codes in my project rather than writing them from scratch. is there some way or a chunk of code that might convert C++ code to matlab code or a ".c" file to ".m" file. please if anyone knows do let me know at the earliest.thanks "fatima " <fatima_naseem2002@yahoo.com> wrote in message <i8ugqn$e9p$1@fred.mathworks.com>... > im working on a project using matlab. i want to use some of the already writen codes in C++. i want to use these c...

Plot problem. Maybe Matlab r2007a bug? Need some help, please.
Hello, I created 2 subplots and I have two problems: 1. Some of the subplot box lines disappear. 2. I changed the x axis from a DateTime vector to DateTime. It is working but the 10^5 still appears in the axis. I tried everything and could not solve these problems. I have 3 files: the m script, the mat data and a screenshot of what I get. Could someone, please, test it and help me out? My email is mdREMOVEmoura@gmNOSPAMailAT.com I can send the files. I can also post here my entire code (20 lines) but the data has a lot of rows and I am not able to post here my screenshot. Thank you...

Urgent help needed in matlab!! please help!!!
i have a matrix which has 16 columns and varying number of rows.. i need to replace the elements ranging from -50 to 50 with zero and the rest should remain the same.. i have coded for a single element search and replace which is [m, n] = size(Data); for i = 1: m if ( Data(i) == 1 ) Data(i) = 0; end end but how do i do it for a range of -50 to 50 instead of a 1 in my code.. could anyone help me out.. also please suggest me if there are any matlab function which does this with out the use of the for loops... Regards, Mohan i have a matrix which has 16 columns and...

Please I need Help with Organic FETs (Precisely,I-V Characteristics Matlab coding)
Hi Guys, Please kindly help with Matlab coding of an algorithm i wrote for ploting the graph of current vs voltage across the channel in a MOSFETs (Ids vs Vds). I have the algorithm if you will like to take a look, i would've pasted it here but most of the equations won't show correctly. Thank you for your time! Bells ...

Web resources about - MatLab coding help needed for basic engineering problem - comp.soft-sys.matlab

History of chemical engineering - Wikipedia, the free encyclopedia
Chemical engineering as a discipline is a little over one hundred years old. It grew out of mechanical engineering in the last part of the 19th ...

Engineering best outcome for student Mai Duong who missed scholarship by a whisker
Vietnamese student who'd dreamt of a perfect score has started at Monash University thanks to a benefactor who is staying under the radar.

Elon Musk hires Apple’s alloy expert to lead materials engineering at both Tesla and SpaceX
... the only executive dividing his time between Tesla and SpaceX since the CEO hired Apple’s alloy expert Charles Kuehmann to lead materials engineering ...

Recharge Wrap-up: Uber eyes driverless cars, Carbon Engineering turns CO2 into fuel
... , Rumormill , Videos , Tesla , Alternative Fuels , Emissions , Transportation Alternatives , Technology , Autonomous , Electric Carbon Engineering ...

The majority of teens do not want a career in engineering
Teens understand the importance of technology and engineering for the future of the world, but aren’t really interested in pursuing a career ...

7 tips to ace a final-stage engineering interview at Facebook, from a developer who conducts them
... one. The company has 13,000 employees across 64 offices, and continues to scale in size and ambition. If you'd like to join Facebook's engineering ...

Unwritten Rules of Management Started out in Engineering and Didn't End up Well for the CEO
It could have been worse for all involved. In early 2006, the Interwebs were abuzz with talk of a little booklet William H. Swanson, the then ...

The Nine Lives of QA in Software Engineering
... years, we need to reflect for a moment on where QA has been — especially with the dire predictions in recent years that QA in software engineering ...

One Photo Sums Up The Engineering Brilliance Of El Chapo’s 2015 Prison Break
The Mob Museum, the National Museum of Organized Crime and Law Enforcement, in Las Vegas, began to display an exhibit as of March 1 dedicated ...

Tumblr Hires NYT Engineering Exec Brian Murphy As CTO
He plans to improve on the micro-blogging platform's mobile products. Tumblr has poached the VP of Engineering at the New York Times , Brian ...

Resources last updated: 3/21/2016 9:06:25 PM