Matlab Definition and 1000 Threads

  1. A

    MATLAB Find the Definite Integral of Arccos Function in Matlab | Integral Problem

    I want to find the definite integral of arccos(sqrt(1+x)/10)/(sqrt(x)*x^(2/3)) ,over [0,pi/2]. I ran the following code in Matlab, "syms w double(vpa(int(acos((w + 1)^(1/2)/10)/(w^(1/2)*(w + 1)^(3/2)),w,0,pi/2)))" and got this error message, "? Error using ==> mupadmex...
  2. manjuvenamma

    MATLAB MATLAB: sparse matrices in matlab anamoly?

    In MATLAB, Why is sparse(rand(4)) not same as sprand(4)? Is it not supposed to be? What is the reason? Please see the interaction in MATLAB pasted below. sprand(4) ans = (1,1) 0.8147 >> rand(4) ans = 0.9058 0.0975 0.9649 0.4854 0.1270 0.2785...
  3. F

    MATLAB Need help with matlab code for Newton-raphson ( really bad)

    The code runs but I get the wrong answers can you take a look at the code for this . ANSWERS ****************** x(1) = 1.035 x(2) = 1.086 x(3) = 0.927 ****************** clc clear F = @(x) [15*x(1)+(x(2)^2)-4*x(3)-13;... (x(1)^2)+10*x(2)^2-x(3)-11...
  4. F

    MATLAB Need help with Matlab code for gauss siedel i get errors, need imediat help

    Please I need HELP IMEDIATLY This is the error message that i get ? Error using ==> gauss_sied Too many input arguments. Error in ==> HW_14 at 23 [x_wo, cnt, x_w,cntt] = gauss_sied(xo, A, b, es, lam); clc clearC = [-8 1 -2 -20 2 -6 -1 -38 -3 -1 7 -34]; A = C(:,1:end-1); b = C(:,end);nr =...
  5. M

    MATLAB Creating 3D Surface Plots with Matlab

    Hi all, Can someone please help me, I am new to Matlab and I would like to use the following upload to create a 3d surface plot. I download all the files from: http://www.mathworks.co.uk/matlabcentral/fileexchange/28177-3d-surface-plots-from-excel-data-gui Then I open the MainGUI.m file...
  6. R

    Matlab: Finding a quicker method than simple iteration

    Homework Statement I am trying to speed up a function in MATLAB that solves the equation by simple iteration: λ= \frac{gT^{2}\frac{\text{tanh}(2\pi h)}{λ}}{2\pi} Where λ is wavelength, h is wave height, T is period and g=9.81. Also here where it's a bit easier to read. Homework Equations...
  7. M

    MATLAB Plotting Series in Matlab: Code for Two Series with Cosine and Sine Functions

    I am going to plot two series in Matlab. They are as following. please help me to write the appropriate code for them: 1-f(t)=(2/pi)+(4/pi)*Ʃ(1/(1-4*n^2))*cos(2*n*pi*t) -1≤t≤1 n=1 forN=200 2-f(t)=(4/0.25^2)*Ʃ(sin(0.25*n*pi)/(n*pi)^2)*sin(n*pi*t) -2≤t≤2 n=1,3,5 forN=200
  8. O

    MATLAB Indicate mean with a bar in Matlab

    I want to put the following as an axis label on a plot, but I cannot figure out how to get the bar on top in Matlab \bar \xi Thanks.
  9. K

    MATLAB Matlab- Function for select and use images

    Hi! I'm writing you to ask about a question, to see if anyone knows how to solve it. I'm doing an interpolation process and I would add a function to a Matlab code that would select and use two dates up and down in the process for a selected image (I opened it before with the function...
  10. N

    MATLAB MATLAB User Input Prompt in Functions

    I am working on a program that compares the monochrome intensities of two circular objects within a greyscale image. However, because I'm a beginner I don't know how to have my program locate where these objects are. This means I need to manually input the radius and position of each circle to...
  11. N

    MATLAB MATLAB: Confusing Contour and Color Scale Map Results

    When I use MATLAB to draw contour and color scale map of an array. The result is weird. my code: the first: b=load('c:\...\b.txt'); contour(b) the second: b=load('c:\...\b.txt'); image(b) The results are very different. I upload the array file and two figures.
  12. S

    MATLAB Simple MATLAB to Excel Question

    I've discovered that MATLAB is not my forte. I have a 51x3 matrix that I want to print to an Excel sheet, but with column headers. I can get the matrix into an Excel file and I can get the headers into an Excel file, but I cannot figure out how to get the two together. I've looked up how to do...
  13. J

    MATLAB How to Use Column Values for Plotting in Matlab?

    So I have a dataset... I am trying to use let's say values in column 1 to determine which values I need to plot from columns 5 and 6... Reading about indexing in a matrix doesn't really help as it doesn't hint at how you might use values in one column to select values from another set of...
  14. DryRun

    MATLAB Generate Matrix with MATLAB - 65 Characters

    I have attached the problem to this post. My attempt at the first part (i used 'm' instead of 'l' as it's less confusing, since the latter resembles the digit '1') and here is my script: A = zeros(10); for k=1:10 for m=1:10 A(k,m) = sin(k)*cos(m); end end A The answer: A =...
  15. S

    MATLAB MATLAB Help -- how to ask user for 2 input variables

    I have an assignment where we have to ask the user for a number of data points which then we will graph a linear regression. Enter the number of input data points: 7 Enter [x y] pair for point 1: [1.1 1.01] Enter [x y] pair for point 2: [2.2 2.30] Enter [x y] pair for point 3: [3.3 3.05]...
  16. M

    MATLAB Can someone briefly explain fixed-point? MATLAB

    Hi, I've been through the help files and demos but one question which I can't find the answer to is destroying my confidence with this toolbox. If I write: a = fi(3336770033), why does it write 3336830976? I can't figure out why it's losing my number. I don't need any moving decimals, all I...
  17. H

    MATLAB Matlab code for 2D inverse Fourier transforms

    I have written some routines that compute the 2D inverse Fourier transform, if anyone thinks that this may be useful at all then please let me know and I will gladly post the code.
  18. DryRun

    MATLAB Create MATLAB Script: Average Voltage & Error Range

    Hi I just started a course in learning how to use MATLAB and I'm asked to begin by writing some scripts. This is the problem: A set of independent voltage measurements taken by four observers are recorded. Create a script that prompts the user to input the values of the readings and calculates...
  19. S

    MATLAB How to record in to matlab using two microphones simultaneously?

    I’m working on a project to make a sound source locator. My theory is to detect the sound using two microphone located at a known distance and find out the time delay to make out the direction of the sound. I am using MATLAB to take input from the microphone. To take input from two...
  20. M

    MATLAB Fortran alternative to Matlab 'system' command

    Hi, I have been trying to run a linux executable (written in fortran77) into my another code (also in fortran77). In Matlab, I did it with "system('./<filename>')". But I am not able to do it in fortran script as './' is not simply working for me. I will really appreciate if anyone could...
  21. Q

    How to replace zeros in a matrix by elements of an array in Matlab?

    Homework Statement I have a matrix that contains zeros but it may contain also ones. For example: ID=[1 0 0 0; 0 0 0 0; 1 0 1 1] I'm trying to replace all the ones by zeros and all the zeros by elements of an array EA going...
  22. R

    MATLAB Matlab: Numerical integration of a multivariable symbolic function

    I have a symbolic function of three variables which I'm trying to numerically integrate wrt a single variable. Consider (syms x y a) and the function f(x,y,z). Here are some things I've tried, without success: 1. >>int(f(x,y,z),x,a,b) which analytically integrates f wrt x from a to b but...
  23. Z

    MATLAB Solving MATLAB Problems with R1, RF, R2 and w Variables

    I have such MATLAB problem: I create variables R1 RF R2 and w so: Code: syms RF R1 R2 w then I write expression: Code: 3*R1*w*(RF + 200)/((R2*w*29*i + 3)*(3*R1*w - 2*i)) which gives: Code: (3*R1*w*(RF + 200))/((3*R1*w - 2*sqrt(-1))*(R2*w*29*sqrt(-1) + 3)) why sqrt(-1) and not i...
  24. C

    MATLAB Matlab fmincon violates nonlinear inequality during search

    Hi everyone, I am trying to solve an optimization problem using fmincon in Matlab with a nonlinear inequality restriction. Part of the objective function is undefined if this nonlinear inequality is violated. I also set up lower and upper bounds for fmincon. I use the "interior-point"...
  25. caffeinemachine

    MATLAB How to numerically(or otherwise) solve these in mathematica(or matlab)

    The values of t_1,t_2 and t_3 are to be found out corresponding to the values of the other variables inputted by the user. I tried using "FindRoot" in Mathematica 7 but it says "solutions don't converge, perturb the initial values". I tried many set of initial values but none worked. Is there...
  26. U

    MATLAB Regulate Grid Transparency in Matlab - Uku

    Hello! Is there a way to regulate grid transparency in matlab? Thanks, Uku
  27. Y

    MATLAB Matlab ode45 referencing past value

    I am using ode45, but have a value that is based upon its own past values. I want to be able to include a parameter that equals (y(3) at time t) - (y(3) at time (t- 30days)). Is there a way to include this using ode45? Thank you in advance!
  28. Z

    Understanding Symbolic Math in MATLAB: Real and Imaginary Parts

    I have such MATLAB problem: I create variables R1 RF R2 and w so: syms RF R1 R2 w then I write expression: 3*R1*w*(RF + 200)/((R2*w*29*i + 3)*(3*R1*w - 2*i)) which gives: (3*R1*w*(RF + 200))/((3*R1*w - 2*sqrt(-1))*(R2*w*29*sqrt(-1) + 3)) why sqrt(-1) and not i? furthermore? if I want real part...
  29. J

    MATLAB MATLAB help for modelling with changing variables.

    Hi, I'm new to MATLAB and programming, but I hoping to find out if I can have a variables in my program take on certain values only for certain time intervals. For example, I am using ode23s to solve some equations for me, but for the time interval [0,10] I would like one of the variables...
  30. M

    MATLAB How to Suppress Output in MATLAB Using eval()?

    I get this example from >>help eval and add a semicolon.for n = 1:12 eval(['M' num2str(n) ' = magic(n)']); end The above commands display all 12 magic square. How do I suppress the output? I only want MATLAB to assign the variables not display them.
  31. Q

    Importing data from text file into Matlab

    Homework Statement I would need some help with extracting two matrices from a text file into Matlab. First is the 60x3 matrix of node coordinates. Second is the 24x8 matrix of node numbers assigned to elements. I have 24 brick elements so each of the elements has 8 nodes. But there are some...
  32. R

    MATLAB Mathematica to MATLAB translation

    Hi, I have some Mathematica code I want to translate in Matlab, does anyone know how to translate the Table [expr,{i,a,b}]to Matlab? I made one with a loop, but loops are very slow and I am going to analyze large datasets with the functions.
  33. P

    MATLAB: Finding the 5th Root using Newton's Method

    Homework Statement The solution of the nonlinear equation x^5-P=0 gives the fifth root of the number P. A numerical solution of the equation can be calculated with Newton’s method. The solution process starts by choosing a value x1 as a first estimate of the solution. Using this value, a...
  34. M

    MATLAB What is the best wayto teach myself Matlab

    I am a graduate student in Applied Math, and I need to know Matlab. What is the best way to teach myself. How long do you think it would take me to know the basics, and to be able to program in Matlab? I don't really have any background in a Programming language. I have used Fortran, but that...
  35. V

    MATLAB Matlab, how read and extract matrices

    Hello, I'm new here and in matlab, so if I do mistakes, please, tell me. I'm working on my thesis and I need to extract some matrices and elements, but I can't write the for-loop exactly. For example, I have to read six matrices (but then I'll have more matrices) and this is too long matrix_1...
  36. A

    An easy? Matlab Problem involving matrices

    Homework Statement The Attempt at a Solution %2.11 x=1:0.5:5; a=sqrt(2.8); n=[1:1:100]; Sn=prod(1-(x.^2)./(n.^2-a^2)); S_inf=(a/sqrt(a^2+x.^2)).*sin(pi*sqrt(a^2+x.^2))/sin(pi*a); e_n=100*(Sn-S_inf)./S_inf I know I can't use ./ if the two matrices are different, meaning x./n. How...
  37. M

    MATLAB Change X & Y-Axis Scale in MATLAB

    Hi, how can i change x and y-axis scale to make sure that x and y-axis are on the same scale in matlab? my x-axis is from 0 80 but the y-axis is from -3 to 5, so in plot the axis are not the same but i want to have same scale on both axis. Thank you.
  38. M

    MATLAB My Matlab for loop wont output the matrix I need

    I'm somewhat new to Matlab and am having issues with a nested "for" and "if" loop. My code is below. This code is combining a binary signal with a cyclic one. I'm trying to create a matrix with the amplitude condition in the first column and in the second column I want the sum of the number of...
  39. M

    MATLAB Plotting Multiple Pictures with Points from a Matrix in MATLAB

    Hi all I am novice MATLAB programmer, and I need alittle help with plotting points, given in a txt. file. I have a text file containing 56 points for 40 pictures. I've loaded the txt file by "load -ASCII nameofthefile.TXT" - and thereby created a matrix <112x40 double> the first 56 rows...
  40. M

    MATLAB Select variable automatically in matlab

    Hi, I want to select my variable automatically in MATLAB so I used the following commands: (may variable for example are: Mpoint1,Mpoint5,Mpoint14,...) for i=1:50 if exist (eval(['Mpoint' num2str(i)])); statements else...
  41. F

    MATLAB How Can I Generate a Poisson Distributed Vector Without Zeros in MATLAB?

    I want to generate a Poisson distributed vector of random numbers, without any of the numbers being 0. The code I have is k = poissrnd(kmean,1,N); % where kmean is the mean of the distribution, and has been defined previously %The above generates a N by 1 vector of Poisson distributed...
  42. B

    MATLAB Matlab: How to Remove Saved Paths

    You know how sometimes a search engine will save your searches? Kind of how Matlab saves the paths you use. How do you delete that history? Does anyone know the command or how this is done? If so please enlighten me. I tried some tricks I saw on google but they did not seem to get the job done...
  43. A

    MATLAB Problem with four system ode matlab

    Hi, I am a newbie to matlab I have 4 equations ode to a system, dxdt=-c*z*s') dydt=((-1.021*(y^2))/(b+a))-(2.081015257+(6.936717523*x))/(b+a)+((p*r)-(p*j)/(b+a))-(((p^2)-2*p*(s^2)*c*z^2))/2*p')...
  44. M

    MATLAB Plotting Matrix in Matlab Loop - Mathias

    Hi, I have a matrix for instance as follow: A=[0.087 11.43 17.14 22.86 28.57 34.29 40.00 45.72 51.43 57.15 0.174 5.671 8.506 11.34 14.17 17.01 19.84 22.68 25.52 28.35 0.261 3.732 5.598 7.464 9.330 11.19 13.06 14.92 16.79 18.66 0.349 2.747...
  45. R

    MATLAB How to use Matlab ODE solver events to stop an integration

    How to use Matlab ODE solver "events" to stop an integration I'm using Matlab's ODE solver (specifically ode15s) to solve a system of equations. The sum of the values of the equations eventually arrive at a steady state, but the time at which that occurs is dependent on several things, not...
  46. S

    Displaying Multiple Data Sets in a uitable using MATLAB GUI

    urgent question for MATLAB uitable This is a GUI with a uitable, i want to display 2 sets of data in column Q and column S by clicking a pushbutton below is my code: peakMag1=transpose(peakMag); peakloc1=transpose(peakloc); dat=peakMag1; set(handles.uitable, 'Visible', 'on')...
  47. A

    MATLAB Matlab function errors while using loop

    Hi, Please assist, I write this MATLAB function and receive the error below function f=myfunn(z,x,K,L1,L2,phi) for c=1:3 f=z(c)-(x(2,c).*K(c).*L1)-(x(1,c).*phi(2,c).*L2)./phi(1,c); end function f=myfunn(z,x,K,L1,L2,phi) | Error: Function definitions are not permitted in...
  48. S

    How do I call functions in MATLAB using an m-file?

    I have to make an m-file that asks the user to input two values. Then it performs a series of functions and returns an answer. I have made the functions (each in their own m-file) But I don't understand how you call functions using an m-file. I have to have one main m-file which calls...
  49. D

    MATLAB What is Causing an Error in My Matlab Code for Solving a System of Equations?

    I have function: function dxdy = kkd(t,y) x=y(1); y=y(2); dxdy(1)=-0.02*x+x*x*y+0.01; dxdy(2)=0.02*x-x*x*y; next [t,y]=ode45(@kkd,[0 4],[0 10]); but is error... Where is error??
  50. M

    MATLAB Effortlessly Compute A*B with MATLAB: Simple 100x30 Output Matrix Calculation

    hi simple computation A = 60x60x100 B = 60x60x30 I want to find A*B, by this I mean, I want a 100x30 output matrix where element (k,m) represents the sum of A(i,j,k)*B(i,j,m) over all i,j My brain is simply not working and I'm confusing myself, does anyone have a short line of code to...
Back
Top