Answered
How do I draw a horizontal line at a fixed height on the y axis and print the coordinates of the points I intercept?
th = linspace(0,2*pi) ; x = sin(th) ; plot(th,x) hold on line([th(1) th(end)],[0.4 0.4]) For finding intersections use...

5 years ago | 0

Answered
How do I change color diffusion in jet colormap?
%% Example data x = (2:-0.1:0); data = sin(x); %% Shift the values towards the center, so you get a circle instead of an annu...

5 years ago | 2

Answered
How do i define a variable as a function?
syms theta(t) f=cos(theta(t)); diff(f,t)

5 years ago | 0

Answered
Search a given row array in a matrix and get position
A=[0 0 0 0 0 0 0 0 0 178 0 0 0 0 0; 1 2 5 3 2 4 178 5 6 2 2 2 2 2 2; 0 2 178 178 178 178 178 178 178 178 178 0 2 3 2]; ch = o...

5 years ago | 0

| accepted

Answered
Converting a matrix to string
X = rand(3,3); Y = rand(3,3); Z = rand(3,3); figure plot(X,Y,'.') text(X(:),Y(:),num2str(Z(:)))

5 years ago | 0

| accepted

Answered
How to rearrange a column by a specific order?
How about using sort? s = [{'Done' } {'verify' } {'Done' } {'backlog' } {'verify' } {'verify' }] ; s = sort(s) ...

5 years ago | 0

Answered
How to plot multiple 2D matrix data with different color on the same figure?
I = rand(100,100,10) ; [m,n,p] = size(I) ; [Y,Z] = meshgrid(1:n,1:n) ; X = ones(m,n) ; figure hold on for i = 1:p s...

5 years ago | 1

Answered
how to merge two NetCDF4 files into one
file1 = 'tropomi1.nc' ; file2 = 'tropomi2.nc' ; x1 = ncread(file1,'/PRODUCT/longitude'); y1 = ncread(file1,'/PRODUCT/latitu...

5 years ago | 1

| accepted

Answered
Running an inner loop multiple times.
You may proceed something like shown. Check your code and values once, t is coming as inf. This should give you some idea. numb...

5 years ago | 0

| accepted

Answered
Finding a specific value after analysing the trend of different plots
Read about interp1. You can use this to extract the values you want. Let (x,y) be your data and you want yi for xi: yi = inte...

5 years ago | 0

Answered
how to animate Plot
This should help you: https://in.mathworks.com/matlabcentral/answers/94495-how-can-i-create-animated-gif-images-in-matlab

5 years ago | 0

Answered
How to import data from a txt file that has 256 arrays and 128 data points per array into a 128x256 matrix?
filename = 'SeqLoop.data.kSpaceOS.txt' ; fid = fopen(filename,'r') ; S = textscan(fid,'%s','delimiter','\n') ; fclose(fid)...

5 years ago | 1

| accepted

Answered
I need to create matrix without using loops
Read about the function diff, gradient.

5 years ago | 0

Answered
I have noisy image matrix.I need to plot it on line plot.How do I do it?
You can convert image into column using (:). But I don't think this is the way to check. I = imread('cameraman.tif') ; plot(...

5 years ago | 0

Answered
Creating Surface Plot from a Matrix with 3 Columns
x = speed ; y = Torque ; z = bsfc ; %%structured xi = unique(x) ; yi = unique(y) ; [X,Y] = meshgrid(xi,yi) ; Z = reshape(z,...

5 years ago | 2

Answered
Add next and previous business date of each date in array row
d = datetime('today') d0 = d-day(1) d1 = d+day(1)

5 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Your LHS is a single elememnt and RHS is a 1x2 matrix, which cannot be saved. May be you want this? a=[0.3; 0.7]; x0=[1; 1];...

5 years ago | 0

| accepted

Answered
Having error "Can't define variable t"
Why do you want to reinstall MATLAB? You are not running the function/ code properly. Copy your code in a single file, make it a...

5 years ago | 0

| accepted

Answered
Exporting mesh generated by MATLAB to ASCII file?
Have a look on the model. model.Mesh In the above you have elements as well as nodal connectivity. You can pick from there and...

5 years ago | 1

| accepted

Answered
How to remove start and endpoint line?
Introduce NaN at the end of the line.

5 years ago | 0

Answered
Why am I getting: "invalid syntax at "(" .A might be missing a closing ")"
You are missing an operator, multiplication operator at many places. (cos^2*( .. %underneath

5 years ago | 0

Answered
How do I plot a contour plot using my data?
Your input is a 3D matrix. contourf needs 2D matrix to plot contours. Input a 2D matrix. for i = 1:size(data_mat_ac_removed,3)...

5 years ago | 0

Answered
Output vector from structure
[driver(:).status]

5 years ago | 0

| accepted

Answered
Accessing multiple folders and extracting specific image files
https://in.mathworks.com/matlabcentral/answers/401335-how-to-access-text-files-from-many-subfolders-within-a-folder https://in...

5 years ago | 0

Answered
How do I draw a graph using a for if statement?
x = 0:0.01:30 ; y = zeros(size(x)) ; y(x<0) = 5 ; idx = 0 >= x & x <10 ; y(idx) = 5*x(idx)+5 ; y(x >= 10) = 5*sqrt(...

5 years ago | 0

Answered
How its possible do define this function in Matlab?
function g = func(t) if t >=0 && t < 1 g = t+1 ; elseif t >= 1 && t < 2 g = 0 ; elseif t >= 2 && t < 3 g = 2-t...

5 years ago | 1

Answered
Vectorize nested for loops
You can reshape the matrices and get what you want. But note that, C will be over written when i-index changes. You may procee...

5 years ago | 0

Answered
Hi . what is the difference between numel() and length() of a given vector ?
numel gives you total number of elements present in the array. i.e. it is product of result of size function. A = rand(10,3) ;...

5 years ago | 5

| accepted

Answered
How to off the axis in eye diagram and save as image?
set(get(gcf, 'Children'), 'Visible', 'off')

5 years ago | 0

| accepted

Answered
How to read tab delimited .txt file line by line (File attached)?
fid = fopen('Data.txt'); tline = fgetl(fid); while ischar(tline) disp(tline) tline = fgetl(fid); end fclose(fid);

5 years ago | 1

Load more