Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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 ...

quasi 9 anni fa | 0

| accettato

Risposto
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);

quasi 9 anni fa | 2

| accettato

Risposto
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...

quasi 9 anni fa | 0

Risposto
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) ...

quasi 9 anni fa | 0

Risposto
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)

quasi 9 anni fa | 0

| accettato

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

quasi 9 anni fa | 0

Domanda


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...

quasi 9 anni fa | 1 risposta | 0

1

risposta

Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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...

quasi 9 anni fa | 3

| accettato

Risposto
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...

quasi 9 anni fa | 0

Risposto
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...

quasi 9 anni fa | 0

| accettato

Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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...

quasi 9 anni fa | 0

Risposto
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...

quasi 9 anni fa | 3

| accettato

Risposto
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...

quasi 9 anni fa | 0

| accettato

Risposto
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...

quasi 9 anni fa | 0

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

quasi 9 anni fa | 1

Risposto
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: ...

quasi 9 anni fa | 0

| accettato

Risposto
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^...

quasi 9 anni fa | 1

| accettato

Risposto
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...

quasi 9 anni fa | 0

| accettato

Risposto
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...

quasi 9 anni fa | 0

Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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...

quasi 9 anni fa | 0

| accettato

Risposto
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...

quasi 9 anni fa | 1

Risposto
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...

quasi 9 anni fa | 1

| accettato

Risposto
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 =...

quasi 9 anni fa | 0

Risposto
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...

quasi 9 anni fa | 0

Risposto
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) ...

quasi 9 anni fa | 2

| accettato

Carica altro