hi, I 've written my program with the matlab editor but I want to use it in a matlab function block in a model. the problem is that my program runs without problem when runned by the command window but when I simply test it in a model using constant values as inputs, an error occurs. the Simulation Diagnostics says: Error in 'dokimh_kodika/MATLAB Fcn'. Evaluation of expression resulted in an invalid output. Only finite double vector or matrix outputs are supported. How can I convert my outputs so that they compromise with the expected outputs of the matlab function block? Any he...

This is what I have so far and the last local function I have no idea how to work out.: function sortedarray=arraySort(array) sortedarray={}; while ~isempty(array) [m,pos]=loc_findSmallest(array); sortedarray=[sortedarray m]; array=[array(1:pos-1) array(pos+1:end)]; end function [m,pos]=loc_findSmallest(array) %This function takes as its input a vector and %gives as its output the smallest value in that %vector and its position. m=array{1}; pos=1; for i=2:length(array) if loc_isLessWord(array(i),m) m=array(i); pos=i; end end function isLe...

Hi guys I have a problem with MATLAB function. I have made a simulink file which includes two MATLAB function, but I can not save it. some error appears when I want to save it: Error using==> sf failed to save this model. and in simulation diagnostic window, these errors appear: Assertion Error SaveMachines Error Do you know how I can fix these errors? Thanks, Ayoub ...

Hello everybody! I have a little problem and I hope have an answer here. Sorry for my bad english, I am french and I don't speak English very well. :) I have a very simple function J(x,A,B) which returns y =0.5*x'*A*x-B'*x; When I write in the script: a=[1;2] b=0.5*a'*An*a-Bn'*a; it works without problem and Matlab returns the value of b. (there is no problem with dimensions) but when I call the funtion J: b=J(a,An,Bn) Matlab displays a error: "Undefined function or method 'J' for input arguments of type 'double'." I don't understand where this error comes from. Can anyone help me? :=) On May 18, 5:46=A0am, "Raphael " <raphael.hert...@gmail.com> wrote: > Hello everybody! I have a little problem and I hope have an answer here. = Sorry for my bad english, I am french and I don't speak English very well. = :) > I have a very simple function J(x,A,B) which returns y =3D0.5*x'*A*x-B'*x= ; > > When I write in the script: > a=3D[1;2] > b=3D0.5*a'*An*a-Bn'*a; > it works without problem and Matlab returns the value of b. (there is no = problem with dimensions) > but when I call the funtion J: > b=3DJ(a,An,Bn) > Matlab displays a error: =A0"Undefined function or method 'J' for input a= rguments of type 'double'." > I don't understand where this error comes from. > Can anyone help me? :=3D) Show the code that defines the...

Hi to all, I have a function in Matlab called KruskalovAlgoritam(graf), which calles function ZamijeniBoju(najkrace_drvo, cvor_boje). cvor_boje has dimensions 13x1, but when I want to access element cvor_boje(3,1) it shows me next error: ??? Attempted to access cvor_boje(2); index out of bounds because numel(cvor_boje)=1. Error in ==> ZamijeniBoju at 3 boja=cvor_boje(2); What coulde be a problem? Has Matlab any problems with calling functions from functions? Thanks in advance... On Dec 18, 10:25=A0am, "Amer " <amer_kin...@hotmail.com> wrote: > Hi to all, ...

1. Function 1: Given the (x,y) coordinates of three points A, B and C calculate the polar coordinates of the vectors from A to B (Ob, Rb) and from A to C (Oc, Rc). Imagine that you have made a triangle out of the 3 points A,B and C. Return the distance between B and C , the angle O between the lines from A to B and from A to C, as well as the angle O3 between the sides from C to B and from C to A. You can do this using geometry/trig or dot products of vectors. 2. Function 2 : Resolve the angle of the line from C to B into cartesian coordinates with the direction of the the line from C to B measured from the vertical axis positioned at point C. 3. Function 3: Now assume that an aircraft is at point C with a heading Op measured from the vertical axis at C. Calculate the relative angle of the line from C to B measured from the central axis of the plane(direction of the heading) 4. Function 4: This function evaluates the coordinates of the points A,B and C and the heading of C for values of time from 0 to 4 in increments of .1 The coordinates will be vectors. The point A is fixed at (0,0) The coordinates of B and C vary in time. Xb = sin ( 3 t) Yb= t^2- 5 Xc = sin(t) / t ( Xc = 1 when time = 0 ) Yc = abs( t^2- 4) HEADINGc = pi/2 + .25 pi/2 t = pi/2 (1 +t/4) 5. Function 5: This function will use the other functions that you wrote. This function will take the (x,y) coordinates of 3 points and the heading of a plane located at the thir...

I sort of assumed that Mathematica should readily solve function of function equations like ... Equn = { f [x_] == f [ f [x] ] - 2 x } Solve[Equn, f , x] , but it does not. Is there a better some other way to code it? This is based on William Elliot's post in sci.math http://groups.google.co.in/group/sci.math/browse_thread/thread/659ea3f0d1e0efc5?hl=en# Narasimham ...

Hey all, I am trying to run the following code (taken from http://www.mathworks.com/access/helpdesk/help/techdoc/ref/pdepe.html): function pdex1 m = 0; x = linspace(0,1,20); t = linspace(0,2,5); sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t); % Extract the first solution component as u. u = sol(:,:,1); % A surface plot is often a good way to study a solution. surf(x,t,u) title('Numerical solution computed with 20 mesh points.') xlabel('Distance x') ylabel('Time t') % A solution profile can also be illuminating. figure plot(x,u(end,:)) title...

Why am I having difficulties using the FITSREAD function in MATLAB? I am trying to read filename.fits file into MATLAB using the following code: data = fitsread('filename.fits'); but I receive the following messages: data=fitsread('filename.fits'); ??? Error using ==> fitsinfo (readheaderunit) Unexpected FITS card image format. FITS file may be invalid or corrupt. Error in ==> fitsinfo.m On line 219 ==> [info.PrimaryData,headertype,datasize,atEOF,extensions] = readheaderunit(fid); Error in ==> fitsread.m On line 39 ==> info = fitsinfo(filename); Sincere...

hello all I believe there have a lot of basic function like bessel function in matlab, where can I get a summary of basic matlab function(like box function....) which are very useful in signal processes? Thanks a lot Cheers ...

Hi all, I am using a MATLAB function block in my Simulink model. In this block, I use an if statement like the following in a portion: function index = find(max(Jdiag)==Jdiag) ; if index ==4 p(1)=(J(3,2)-J(2,3))/p(4); p(2)=(J(1,3)-J(3,1))/p(4); p(3)=(J(2,1)-J(1,2))/p(4); end When I start the simulation, it gives an error saying that : Expected a scalar. Non-scalars are not supported in IF or WHILE statements, or with logical operators. Instead, use ALL to convert matrix logicals to their scalar equivalents. Function 'x' (#396.836.845), line 29, colu...

Hey, I have a problem running the simple code below as embedded MATLAB in simulink: function AngleInChamber = fcn(u,nSl,nCh) %#eml eml.extrinsic('fcn') Vaneangle = (u:2*pi/nSl:u+2*pi-2*pi/nSl)'; %Angular interval between the vanes ChamberIntervalValues = (0:2*pi/nCh:2*pi)'; i=1; while (i<=nSl) if Vaneangle(i)>=2*pi, Vaneangle(i)=Vaneangle(i)-2*pi; end i = i + 1; end AngleInChamber = zeros(1,nCh); i=nSl; while (i>0) j=1; while (j <= nCh) if Vaneangle(i) >= ChamberInte...

I am new to Simulink and trying to learn it. I do have some experiance in MATLAB. I have defined a simulink model that takes input from MATLAB workspace. This input is passed into an embedded function, where it is multiplied by 2 and 4 to produce two signals. I need to output these signals from the embeded function and display it in a scope using MUX. Following is the embeded function that I defined: ******************************************************** function [Filtered_disp_LowPass, Filtered_disp_HighPass] = fcn(Airspring_displacement) % This block supports the Embedded MATLAB subse...

Here is my code and somehow C++ is failing to communicate with Matlab: Engine *engOpen(const char *startcmd); const char *stringA = "cd('D:/Waqar');"; int engEvalString(Engine *ep, char * (stringA)); const char *string = "D = importdata('InputMatrixA.txt', ' ');"; int engEvalString(Engine *ep, char * (string)); const char *string2 = "dlmwrite('m2.txt', D, 'delimiter', '\t', 'newline','pc');"; int engEvalString(Engine *ep, char * (string2)); ...

hi , i hope this the right forum for this type of questions: please i really need help in solving this problem: A random process is defined by x(t) =3D A cos(2*pi*f0*t+=CE=A6), 0=E2=89=A6= t=E2=89=A7T, where A and f0 are constants and =CE=A6 is uniformly distribut= ed random variable in the range -pi=E2=89=A6=CE=A6=E2=89=A7pi . Generate sa= mples (at the rate fs=3D80kHz ) over a time interval of length T. Choose th= e signal length T so that you get about 900 to 1000 samples of the simulate= d analog signal x(t). i)Plot the time signal with the function plot so that the samples are conne= cted. Make sure that you label the time axis of the simulated analog signal= .. ii)Find the autocorrelation of the signal and plot it. iii)Find the Fourier transform of the autocorrelation and plot it. On Thu, 04 Oct 2012 09:44:26 -0700, Jamal Alkit wrote: > hi , > i hope this the right forum for this type of questions: please i really > need help in solving this problem: > > A random process is defined by x(t) = A cos(2*pi*f0*t+Φ), 0≦t≧T, where A > and f0 are constants and Φ is uniformly distributed random variable in > the range -pi≦Φ≧pi . Generate samples (at the rate fs=80kHz ) over a > time interval of length T. Choose the signal length T so that you get > about 900 to 1000 samples of the simulated analog signal x(t). > > i)Plot the time signal with the function plot so that the samples are > connected. Make sure that ...

Hi, I am having an odd problem with generating a movie. I have the following code: figure colormap('hot') set(gca,'nextplot','replacechildren'); for i=1:numOfDates-1 pcolor(triu(Corr_matricies(:,:,i))) title(dates{i}) caxis([-1 1]),colorbar('EastOutside') F(i) = getframe(gcf); end fps = 2; figure axis off movie(gcf,F,1,fps,[0 0 0 0]) This code basically creates a bunch of frames, and plays a movie of those frames. When the movie command is executed, about halfway through (around frame 25), I get the following error message: ??? Error using =...

i need digital signal processing function files commonly used in matlab but the syntax will be different from what is stated on the algoithm of that function. for example, i need the function file for 'convolution' which is 'conv'..but i need different algorithm from its original syntax stated on the matlab..... i need this file on sunday... please email me if u have a solution to my problem.. aliaz_pogi@yahoo.com ...

Hi, I have matlab 6.1.0.450 installed on Linux jane 2.4.20-8custom #2 SMP Fri Jul 2 18:02:41 EDT 2004 i686 i686 i386 GNU/Linux, when I am trying to call imshow(im), and fspecial('hewitt') etc., it complains "undefined variable or function", I checked the path, it does include "/usr/local/matlab/toolbox/images/images" where imshow.m resides. I can copy imshow.m to my own work directory for matlab program, and it works partially, because in imshow.m it calls another function in "/usr/local/matlab/toolbox/images/images", and the program with show error when ...

Hello...I used to use "specgram" function of matlab, in a M file builded to perform FFT spectral analysis in signals. I am trying to build a VI to perform the same action.In a blank VI I created a Mathscript node and pasted the code of my M file inside it. After adjust the input and outputs of the node, I run the VI and received the Error message "Unknown symbol on line 7 : specgram"How do I solve this issue? How do I execute the specgram inside the mathscript node?Thank you in advanceDan07 Hello dan07, Could you post here the code you are using in Mathscript node? Regards, Luciano Borges National Instruments Brazil Hello,The specgram function is not currently present in LabVIEW MathScript. You may be able to get what you need from using a LabVIEW VI. Try searching the LabVIEW help for "spectrogram." You should see an entry for "STFT Spectrograms." This VI may perform the analysis you need. As for MathScript, this function was present in the open beta of 8.6, so it may be available once 8.6 releases.Grant M.Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments Hello Luciano... - First of all I use the ?load? command to open an ASCII file into Matlab;- The ASCII file has 3 columns:o Column 1: Time Serieso Column 2: 900 s...

Hello, I observed a strange thing while decoding conv. codes using vitdec function from matlab. I am using a [7,5] constraint length 3 code. I noticed that the BER changes significantly when I change the message length(keeping the traceback length of 15). I would really appreciated you kind response in this regard. Here are the BER results: Msglen: 15 30 300 3000 30000 BER: 2.1e-3 8.2e-4 1.5e-4 9.5e-5 8.7e-5 SNR(unadjusted) of 4dB Here is the matlab code: clear all snr=4; k=3;%constraint length msglen=20;%msg length tblen=15;%traceback length for snr_idx=1:length(snr) p=sqrt(0.5)*(10^(-1*snr(snr_idx)/20)); no_bit_errors=0;no_bits=0; while no_bit_errors<100 msg = randint(1,msglen) % Random data t = poly2trellis(k,[7 5]); % Define trellis. [code fstate] = convenc(msg,t,0); % Encode the data. code noise=p*randn(1,2*msglen); inp_bit=2*code-1; rec_bit=inp_bit+noise; [hrdout]= vitdec( (rec_bit>0), t, tblen, 'trunc', 'hard' ) no_bit_errors=no_bit_errors+sum(abs(msg-hrdout)); no_bits=no_bits+length(msg); end BER(snr_idx)=no_bit_errors/no_bits end On Jul 12, 12:35 pm, designenginee...@gmail.com wrote: > Hello, > I observed a strange thing while decoding conv. codes using vitdec > function from matlab. > I am using a [7,5] constraint length 3 code. I noticed that the BER > changes signific...

I have tried this: #!/bin/bash cd /home/milenko/Documents matlab -nojvm -nodesktop -r "scale1.m" matlab -nojvm -nodesktop -r "scale2.m" But I get: ??? Undefined variable "scale1" or function "scale1.m". What is wrong? "Milenko " <mpmarkovic@fc.ul.pt> wrote in message news:jm1cop$h64$1@newscl01ah.mathworks.com... > I have tried this: > #!/bin/bash > > cd /home/milenko/Documents > > matlab -nojvm -nodesktop -r "scale1.m" > matlab -nojvm -nodesktop -r "scale2.m" > > But I get: ...

take a simple controller for example, I wrote the embedded matlab function like followings: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function y = fcn(p_actual, p_desired, v_actual) % p_actual: the actual position % p_desired: the desired position % v_actual: the actual velocity % actual velocity v_actual = (p_actual - p_last) *1000; %store the actual position for the next step p_last = p_actual; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% in C/C++, I can initialize this p_last to zero before using it, but how to do it in matlab embedded functions? Thanks. Sorry, I made a mistake when calling ...

Hello Everyone: I am having problem in using matlab functions from C++. Here is my C++ compiler info: Microsoft Visual C++ 2008 SP1 I have included engine.h, matrix.h, and tmwtypes.h files as required by the program and almost following the procedure mentioned in engwindemo.c file. Here is my example code: Engine *engOpen(const char *startcmd); const char *stringA = "cd('D:/Waqar');"; int engEvalString(Engine *ep, char * (stringA)); const char *string = "D = importdata('InputMatrixA.txt', ' ');"; int engEvalString(Engine *ep, char * (string));...

Hi there, Can you please help regarding a problem in xlsread function. whenever I am calling xlsread it is showing the following error message and the programs halts. No public field DisplayAlerts exists for class COM.excel_application. Error in ==> xlsread at 241 Excel.DisplayAlerts = 0; Please help. Thanks in advance. Sandipan, It seems there is something wrong with MATLAB's connection to Excel. Can you reproduce this after you restart your computer? Do you see a lot of properties and methods when you do: >> Excel = actxserver('excel.application') Excel = COM.excel_application >> inspect(Excel) >> methods(Excel) >> fieldnames(Excel) Do you see DisplayAlerts? What version of MATLAB are you using? What version of Excel are you using? If none of these suggestions or questions Hope that helps, Gadi ...

... (a ball attached to a spring ) in classical mechanics (A-B) and quantum mechanics (C-H). In quantum mechanics (C-H), the ball has a wave function ...

... news for those with a sweet tooth - a recent study has found that regular chocolate consumption is associated with better cognitive function. ...

Al-Bawaba Cisco launches new network functions virtualization infrastructure solution to help service providers run network ... Al-Bawaba ...

Google has extended its pit-stop feature the ability to find places to stop off on journeys to iPhone and iPad users with the release of Google ...

Hublot will probably be the next LVMH watch brand to add smart functions, following TAG Heuer’s footsteps in combining Swiss craftsmanship and ...

Yahoo Food is closing, and other digital magazines on tech, travel and beauty are also scheduled for closing or major cutbacks.

How the FBI transformed after 9/11 provides lessons on how to balance organizational structure, function and identity when they become scrambled. ...

... build deploying soon to the alpha server, garrison missions no longer reward gold and the water-walking Water Strider mounts no longer function ...

We all know it’s a ball to drive a slow car fast, and they don’t come much baller than today’s Nice Price or Crack Pipe Corolla with its diesel ...

... Formula 1 cars have tires with big sidewalls like your grandpa’s Plymouth. But there’s a reason why there’s so much rubber; these tires function ...

Resources last updated: 3/30/2016 12:11:17 AM