Answered
How can I display data with large absolute range in a 3D surface plot?
If all your Z data are greater than zero, taking the natural or base-10 logarithm could be an option, unless some other transfor...

7 years ago | 1

Answered
solving three equations for 3 unknows
For your system, use vpasolve (link) to get numeric results. You may also need to use the double function if you want to use th...

7 years ago | 1

| accepted

Answered
assign empty vector to an element of a vector in a for loop
One option could be to assign it instead as a cell array: r0{i0} = .. .Note the curly brackets {}.

7 years ago | 0

| accepted

Answered
there is always zero elements
The reason is that your ‘i’ index skips the even-numbered elements, so the even-numbered elements are set to 0. The easiest w...

7 years ago | 0

| accepted

Answered
how to calculate y where y=-1 when x<0 and y=2 when x>2?
One approach: x = linspace(-5, 5); y = -1.*(x<0) + 2.*(x>2); figure plot(x, y) grid ylim([-3 3]) This uses ‘logical in...

7 years ago | 1

Answered
how can I find elements in matrix A between elements in matrix B
I would use the discretize (link) and splitapply (link) functions for this. (They were introduced in R2015b.) D = load('sign...

7 years ago | 0

| accepted

Answered
Error in fmincon. How to write "x0" as an array. Optimization
You need to return your ‘y’ variables as a vector, not individual arguments. Thsi should work in your fmincon call: objF = ...

7 years ago | 1

| accepted

Answered
Importing a tif picture into Matlab
Try this instead: Itif = imread(File) imagesc(Itif) Note that the single quotes around 'File' make it a string itself, not t...

7 years ago | 0

| accepted

Answered
Please help. Error "array indices must be positive integers or logical values" bot if i remove the "0.1" so it looks like this m=[1:10] it works
Since ‘m’ contans non-integer elements, you need to index into it, not use it as an index: m=[1:0.1:10] format long for i=1:...

7 years ago | 1

| accepted

Answered
Partial Fraction Expansion Issue/Question - confusing result
It just appears to be confusing. The Symbolic Math Toolbox partfrac function gives: or with the fractions rationalised: ...

7 years ago | 0

| accepted

Answered
displaying the radius on the plot
I am not quite certain what you want. The Code — t = linspace(0, 2*pi); r = [1.5; 2]; ...

7 years ago | 0

| accepted

Answered
Spectrogram of a song
Your song may be a two-channel stereo file. Stereo files are (Nx2) matrices. Try this: [x(:,1),fs]=audioread('estrellita.m...

7 years ago | 0

| accepted

Answered
Problem in integration in an array inside integrand
You are using ‘R’ in too many contexts. It is a vector, however it is also an argument to your anonymous functions, and anonymo...

7 years ago | 0

| accepted

Answered
convolution integral with ode45
Try this: odefcn = @(t,y,c,F,k,m,w) [y(2); -(k.*y(1) - F.*cos(t.*w) + integral(@(tau)c(t - tau).*y(2).*tau, 0, t))./m]; c = @...

7 years ago | 1

| accepted

Answered
Counting the numbers in a column
histogram

7 years ago | 0

Answered
how to calculate the integral of function?
Try this: syms L m n y assume(m,{'positive','integer'}) assume(n,{'positive','integer'}) assumeAlso(m ~= n) I(m,n,L) = in...

7 years ago | 0

| accepted

Answered
Matching Two Numeric Vectors
The ismembertol (link) function is likely appropriate. (Another option is the ismember (link) function, althoughit is likely no...

7 years ago | 0

Answered
how to make a cell array of random number rand{i,j}
Use the num2cell (link) function.

7 years ago | 0

Answered
In an assignment A(:) = B, the number of elements in A and B must be the same.
Subscript ‘t’ as ‘t(h)’ and it works: t0=0; tf=12; N=5000; dt=(tf-t0)/N; t=t0:dt:tf; for h=1:length(t); if t(h)<2 ...

7 years ago | 0

| accepted

Answered
Formula for change in amplitude after passing through filters
The ‘formula’ would be the transfer function of your filter, in the context of the frequency content of your signal. For exam...

7 years ago | 0

| accepted

Answered
How do I convert a table to .csv format
Note that .csv files are text files. If you want to save it specifically as a .csv file, tell writetable by including the exten...

7 years ago | 0

Answered
how to use syms variables in function?
In order to do that, you will have to convert ‘A’ to a symbolic object as well: function [A] = Test(a,b) A = sym('A',[1 2...

7 years ago | 0

| accepted

Answered
how does a diff operation works for relational and logical cases with arrays ?
The argument creates a logical array: Lv = [14 5 6 14 32]==14 Lv = 1×5 logical array 1 0 0 1 0 and logical arr...

7 years ago | 0

Answered
Convert Time (string) to Time (numeric)
You can use the datetime data type (with a few alterations, since duration for some reason does not accept datetime objects as a...

7 years ago | 3

Answered
Size of the vector data
It will automatically be double-precision floating-point (double) unless you specify a different data type (such as single, int8...

7 years ago | 1

Answered
Reading in a file with just numbers into a known matrix size
For your matrix as you describe it, just use the load (link) function: YourMatrix = load('YourFile.txt');

7 years ago | 0

| accepted

Answered
Comparing every value in a numeric array to one value in another one
Try this: A = rand(10,1); B = rand(82,3); Result = A - B(9,2); It automatically expands the scalar to the size of the vecto...

7 years ago | 1

| accepted

Answered
solving pohlhausen equation,how I can write true function?
If you have the Symbolic Math Toolbox, let it do the programming for you: % % 2F'''+FF''=0 % % T''+Pr/2 F T'=0 syms F(t) Pr ...

7 years ago | 0

Answered
Problem with fsolve?
After I created values for all the constants (it would have been nice to have had those), this ran for me without error: F = @...

7 years ago | 0

| accepted

Answered
help with adding the text location
You should be able to determine what xlim and ylim are after you do the plot. Try this: x = -10:10; y = (rand(1,21)-0.5)*2...

7 years ago | 4

| accepted

Load more