Search Results

Search found 9638 results on 386 pages for 'matlab engine'.

Page 11/386 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Is Matlab faster than Python?

    - by kame
    I want to compute magnetic fields of some conductors using the biot-savart-law and I want to use a 1000x1000x1000 matrix. Before I use Matlab, but now I want to use Python. Is Python slower than Matlab? How can I make Python faster? EDIT: Maybe the best way is to compute the big array with c/c++ and then transfering them to python. I want to visualise then with VPython. EDIT2: Could somebody give an advice for which is better in my case: C or C++?

    Read the article

  • MATLAB Heart Curve

    - by Arkapravo
    I am trying to get this in MATLAB, however I am not successful ! Any MATLAB gurus out there ? I guess simple commands should work, a program may not be needed. The error, I am getting is; >> t = -pi:0.1:pi; >> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ; ??? Error using ==> mtimes Inner matrix dimensions must agree.

    Read the article

  • Undefined Variable in Matlab

    - by OrangeRind
    The Following is the basic skeleton for my MATLAB program. Each box is a class definition. Scroll down for the error. Note: Each Class has a custom constructor which does not require an external parameter The Error Undefined function or variable 'Troom'. Error in == wallwall.wall at 31 function o = wall(Tr) Error in == mainfile at 5 w1 = wall(); This comes when I create an object of Class wall from another file "mainfile" Question Why is this happening? Am I getting wrong in the concepts of OOP for Matlab specific? How do I resolve this? Thanks in Advance!

    Read the article

  • MATLAB: different function returns from command line and within function

    - by Myx
    Hello: I have an extremely bizzare situation: I have a function in MATLAB which calls three other main functions and produces two figures for me. The function reads in an input jpeg image, crops it, segments it using kmeans clustering, and outputs 2 figures to the screen - the original image and the clustered image with the cluster centers indicated. Here is the function in MATLAB: function [textured_avg_x photo_avg_x] = process_database_images() clear all warning off %#ok type_num_max = 3; % type is 1='texture', 2='graph', or 3='photo' type_num_max = 1; img_max_num_photo = 100; % 400 photo images img_max_num_other = 100; % 100 textured, and graph images for type_num = 1:2:type_num_max if(type_num == 3) img_num_max = img_max_num_photo; else img_num_max = img_max_num_other; end img_num_max = 1; for img_num = 1:img_num_max [type img] = load_image(type_num, img_num); %img = imread('..\images\445.jpg'); img = crop_image(img); [IDX k block_bounds features] = segment_image(img); end end end The function segment_image first shows me the color image that was passed in, performs kmeans clustering, and outputs the clustered image. When I run this function on a particular image, I get 3 clusters (which is not what I expect to get). When I run the following commands from the MATLAB command prompt: >> img = imread('..\images\texture\1.jpg'); >> img = crop_image(img); >> segment_image(img); then the first image that is displayed by segment_image is the same as when I run the function (so I know that the clustering is done on the same image) but the number of clusters is 16 (which is what I expect). In fact, when I run my process_database_images() function on my entire image database, EVERY image is evaluated to have 3 clusters (this is a problem), whereas when I test some images individually, I get in the range of 12-16 clusters, which is what I prefer and expect. Why is there such a discrepancy? Am I having some syntax bug in my process_database_images() function? If more code is required from me (i.e. segment_images function, or crop_image function), please let me know. Thanks.

    Read the article

  • help with matlab and Discrete Fourier transform

    - by user504363
    Hi all I have previous experience with Matlab, but the problem that I face some problems in apply a problem in (DSP : Digital signal processing) which is not my study field, but I must finish that problems in days to complete my project. all i want is help me with method and steps of solving this problem in matlab and then I can write the code with myself. the problem is about the signal x(t) = exp(-a*t); 1) what's the Discrete Fourier transform of the sampled signal with sample rate fs 2) if a=1 and fs =1 , plot the amplitude spectrum of sampled signal 3) fix the sampling frequency at fs = 1(hz) [what's it mean ?] and plot the magnitude of the Fourier Transform of the sampled signal at various values of a thanks

    Read the article

  • In MATLAB can I convert a java boolean to a MATLAB logical?

    - by Adrian
    In MATLAB I'm using a couple of java routines I've written to interface with a MyQSL database. One routine returns a boolean value result <1x1 java.lang.Boolean> >> result result = true When I then use it in a conditional statement I get an error message. >> if result, disp('result is true') end ??? Conversion to logical from java.lang.Boolean is not possible. Is there a way to use the java boolean class as a MATLAB logical type? Or do I have to resort to returning integer values from my java routines?

    Read the article

  • How to create a string array in matlab?

    - by aduric
    I would like to pass a vector of strings from C++ to matlab. I have tried using the functions available such as mxCreateCharMatrixFromStrings but it doesn't give me the correct behavior. So, I have something like this: void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { vector<string> stringVector; stringVector.push_back("string 1"); stringVector.push_back("string 2"); //etc... The problem is how do I get this vector to the matlab environment? plhs[0] = ??? My goal is to be able to run: >> [strings] = MyFunc(...) >> strings(1) = 'string 1'

    Read the article

  • Passing functions as arguements in Matlab

    - by Dave
    Hi, I'm trying to write a function that is gets two arrays and the name of another function as arguements. e.g. main.m: x=[0 0.2 0.4 0.6 0.8 1.0]; y=[0 0.2 0.4 0.6 0.8 1.0]; func2(x,y,'func2eq') func 2.m : function t =func2(x, y, z, 'func') //"unexpected matlab expression" error message here t= func(x,y,z); func2eq.m: function z= func2eq(x,y) z= x + sin(pi * x)* exp(y); Matlab tells gives me the above error message. I've never passed a function name as an arguement before. Where am I going wrong? p.s. sorry about the formatting of code above, I can't seems to get SO to show parts of the code as code.

    Read the article

  • problems with matlab wavrecord and wavread

    - by user504363
    Hi all I have a problem in matlab I want to record a speech for 2 seconds then read the recorded sound and plot it I use the code FS = 8000; new_wav = wavrecord(2*FS,FS,'int16'); x = wavread(new_wav); plot(x); but the error appears ??? Error using ==> fileparts at 20 Input must be a row vector of characters. Error in ==> wavread>open_wav at 193 [pat,nam,ext] = fileparts(file); Error in ==> wavread at 65 [fid,msg] = open_wav(file); Error in ==> test at 2 x = wavread(new_wav); I plotted correctly recorded sound files, but when I want to record new one through matlab I get this errors. I tried many ways by changing FS and 'int16' but nothing happens. thanks

    Read the article

  • How Matlab calculates the camera view angle?

    - by iman
    I am using matlab to visualise a scene. In order to zoom in the scene, I can do that by eather: - Fix the cameraposition and the cameratarget and change the cameraviewangle.or - Fix the cameratarget and the cameraview angle and moving the camera along the viewing line (defined by the cameraPosition and the cameraTarget). I know how to set the values of cameraposition CameraTarget and viewangle, but I do not how to define the optimal view angle. In auto mode of cameraviewangle, matlab calculate the smalest view angle that capture all the scene from the specefied camera position. I appreciate any help in understanding this. Iman

    Read the article

  • matlab: how to transform screen pixels into specific coordinates

    - by user3137385
    I have to draw a curve captured on a image using screen pixels (mouse clicks) into a coordinate system. E.g.: Pixels on the screen, from left to right (130 px to 970 px) correspond to the x-axis of my coordinate system (1000 to 6000). Pixels from bottom to top (670 to 99) correspond to the y-axis of coordinate system (0 to 1.2). How can this be done? Maybe there's a function in matlab doing something like that? Some more explanation: I have a jpg image of a curve on a coordinate system. I've got pixel positions (x,y) of several points on that curve. Now I want to plot same curve into a matlab figure with same x and y axis as on the jpg image.

    Read the article

  • Doesn't Matlab optimize the following?

    - by kloop
    I have a very long vector 1xr v, and a very long vector w 1xs, and a matrix A rxs, which is sparse (but very big in dimensions). I was expecting the following to be optimized by Matlab so I won't run into trouble with memory: A./(v'*w) but it seems like Matlab is actually trying to generate the full v'*w matrix, because I am running into Out of memory issue. Is there a way to overcome this? Note that there is no need to calculate all v'*w because many values of A are 0. EDIT: If that were possible, one way to do it would be to do A(find(A)) ./ (v'*w)(find(A)); but you can't select a subset of a matrix (v'*w in this case) without first calculating it and putting it in a variable.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >