Answered
how to write the randn' s code with just using rand and CLT
Since you don't actually want to use the CLT, then <https://en.wikipedia.org/wiki/Inverse_transform_sampling inverse sampling> i...

9 years ago | 1

| accepted

Answered
How to make a table with multiple variables?
You've only created two vectors, not matrices. You're basically trying to divide a 1-by-5 by a 1-by-7 which doesnt work. What ...

9 years ago | 0

| accepted

Answered
How to initialize a row vector with value zero of size 1xn?
Look up the documentation for the |zeros| function, which you are using: A = zeros(1,n);

9 years ago | 2

| accepted

Answered
Plotting a mean line on a graph
%set up x = 1:0.1:10; r = sin(x); t = 1:91; x = mod(t,2) == 0; m_x = mean(r(x)); m_x2 = mean(-r(~x)); % plo...

9 years ago | 0

Answered
minimize integral function for a parameter
I think you can do something like this. Make a file with your integral that takes in |k|: function [ F ] = int_fun(k) ...

9 years ago | 0

Answered
Plotting an equation at different X
You should look up the |plot| function: incr = 0.1; x = [1:incr:20]; y = (1-x).^-1 plot(x,y)

9 years ago | 0

| accepted

Answered
How can I create it?
Try this A = 2*cos(0.4.*pi.*(repmat([1:5]',1,5) - repmat([1:5],5,1)));

9 years ago | 0

Question


MCC in Matlab 2014b on Windows 10
This is a slightly esoteric question, but for some technical reasons I'm looking to use the Matlab runtime library compiler (mcc...

9 years ago | 1 answer | 0

1

answer

Answered
Function evaluation in each iteration of pattern search exceeding 2* (number of optimization variable)
You have |'SearchMethod'| enabled. This is an optional step which performs a search prior to the polling, resulting in the larg...

9 years ago | 1

| accepted

Answered
Added Variable Plot: Adjusted whole model x-axis range
The added variable plot is little bit complicated; basically, because you have a multi-variable regression, it is trying to give...

9 years ago | 3

| accepted

Answered
Integral of complicated function
There are a bunch of techniques you could use. Matlab has a built-in quadrature <http://www.mathworks.com/help/matlab/ref/integ...

9 years ago | 0

Answered
how to automatically open files and do the commands
You'll have to program this, but it's pretty straightforward. cd 'C:\Users\etc' %your file path with all the files. c = st...

9 years ago | 0

| accepted

Answered
Adding a legend manually for a plot generated by a loop
I think the issue is that you don't want to generate the plot like that; it's slow and makes it hard to label. Check out this s...

9 years ago | 1

| accepted

Answered
How to avoid this warning?
You've created a function named |plot| which has the same name as another function already in Matlab. To fix this, simply ren...

9 years ago | 0

Answered
How to save the variables inside for loop
The easiest way to probably to just use a <http://www.mathworks.com/help/matlab/ref/cell.html cell array>. Es = cell(100,1...

9 years ago | 3

| accepted

Answered
Plotting 1MHz sine wave
Just change this line: t = 0:1/N:S; to this t = 0:(1/N)*S:S; The issue was that you are telling Matlab to create...

9 years ago | 0

| accepted

Answered
separate column into several using descriptive variable
You want the <http://www.mathworks.com/help/matlab/ref/discretize.html discretize> function: x = 100*rand(1000,1); %your dat...

9 years ago | 0

Answered
Putting spacing between strings
You can do this by sending them to strings then concatenating them: A = 1; B = 8; C= 9; space = ' '; str ...

9 years ago | 1

Answered
Not enough input arguments for read an immage
Check out the <http://www.mathworks.com/help/images/ref/im2bw.html documentation>. The function |im2bw| needs two arguments: ...

9 years ago | 0

| accepted

Answered
Undefined function 'mtimes' for input arguments of type 'cell'.?
This expression: sigma=[{0.307*(c_n)^2}*{(2*3.1416/lamda)^1.17}*{L^(1.833)}]-[{0.742*(c_n)^2}*{(2*23.1416/lamda)^0.17}*{(L^...

9 years ago | 1

| accepted

Answered
How expand a matrix?
This should work A = [1 5 8 12 7 5 2 1]; floors = floor(A./3); C = cumsum(3.*ones(max(floors)+1,length(A)),1) A_p = re...

9 years ago | 0

| accepted

Answered
How can a plot from an "if" inside of a while loop?
Try this: N=input('The total number of particles in the system is:'); %The total number of particls in the system n...

9 years ago | 0

Answered
determining indices of double type cells in a cell array of char and double type cells
See if this solves your problem c = {'cat',1,'bird',22,'elephant',3}; %an example of data in the format you have ind = fin...

9 years ago | 1

| accepted

Answered
Genetic Algorithm fitness function for failing parameters
I think you probably want an <http://www.mathworks.com/help/gads/genetic-algorithm-options.html output function>. Basically...

9 years ago | 1

| accepted

Answered
Solve non linear equations system
You need to do a couple of steps. First, make a function which returns the equation you want optimized: function [F] = fun...

9 years ago | 0

| accepted

Answered
Remove help message from quadprog() function
You can call it like this: options = optimoptions('Display','off'); x = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options); T...

9 years ago | 1

Answered
How can I add noise to linear graph
You never added the random noise to your dataset: sample = 100; x = linspace(-5,5); y= 1.6 * x +6; r = rand...

9 years ago | 1

| accepted

Answered
How can I make all the variables in an array 0 after the first time 0 occurs in the array
Generate your |x| as normal, with the many 1's afterwards then call: x = [1,1,1,1,1,0,0,1,1,0,0,0]; %generate x x(find(x =...

9 years ago | 0

Answered
Index exceeds matrix dimensions
Your problem is this: bigDATA = nan(16, 100000); This is a 16x100,000 matrix of NaNs. ii_array = [198 139 81 80 84 2...

9 years ago | 0

Answered
How can I plot discrete x-axis values?
Try this x = [1,2,3,5,7,10]; %your bins y = rand(1,6); %your data numbins = size(x,2); x1 = [1:numbins]; bar(x1,y) ...

9 years ago | 2

| accepted

Load more