Posts

Change row vector to column vector

  How can I change this into a column, at the moment all 750 entries are on one row?    p = normal(1:750)-1; I have tried:    columns = 1; p = normal(1:750)-1; p = p(1:columns); I have also tried:    rows = 1000; p = normal(1:750)-1; p = p(1:rows)'; NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  ,  Finance Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.      Answers:  It is common practice in MATLAB to use the  colon  operator  :  for converting  anything  into a column vector. Without knowing or caring if  normal  is a row vector or a column vector, you can force  p  to be a column...

Matlab saving figure with predefined size

  I have a figure with 2 plots on it. I am trying to save the figure as a png with a longer width.    %%%%%%%%%%%%First%%%%%%%%%%%%%%%%%% a=figure('Name','First Structure'); load C:\Users\William\workspace\P5\FirstAdd.txt n=FirstAdd(:,1); t=FirstAdd(:,2); subplot(1,2,1); plot(n,t); xlabel('n'); ylabel('Time'); title('First Structure''s Add'); grid on load C:\Users\William\workspace\P5\FirstContains.txt n=FirstContains(:,1); t=FirstContains(:,2); subplot(1,2,2); plot(n,t); xlabel('n'); ylabel('Time'); title('First Structure''s Contains'); grid on rect=[250,250,1080,480]; set(a, 'OuterPosition',rect); print(a,'-dpng','First Structure.png'); In the last 3 lines I set the figure window such that the 2 plots are wide enough. However, when I try to save the figure, the image is its default size in which the plots are squished. What am I missing?   NOTE:- Matlabsolutions.com  provide lat...

Multi-Class SVM( one versus all)

  I know that LIBSVM only allows one-vs-one classification when it comes to multi-class SVM. However, I would like to tweak it a bit to perform one-against-all classification. I have tried to perform one-against-all below. Is this the correct approach?  The code:    TrainLabel;TrainVec;TestVec;TestLaBel; u=unique(TrainLabel); N=length(u); if(N>2) itr=1; classes=0; while((classes~=1)&&(itr<=length(u))) c1=(TrainLabel==u(itr)); newClass=c1; model = svmtrain(TrainLabel, TrainVec, '-c 1 -g 0.00154'); [predict_label, accuracy, dec_values] = svmpredict(TestLabel, TestVec, model); itr=itr+1; end itr=itr-1; end I might have done some mistakes. I would like to hear some feedback. Thanks. Second Part: As grapeot said : I need to do Sum-pooling (or voting as a simplified solution) to come up with the final answer. I am not sure how to do it. I need some help on it; I saw the python file but still not very su...

How to remove duplicate rows from matrix

  I want to remove duplicate rows from a matrix. I read How can I remove duplicates in an array but keep the same order?, but this is not exactly what I want. The solution above removes duplicate values (cells) from matrix (and returns a vector), but I need to remove duplicate  rows  and return a matrix — the same matrix without duplicate rows. Example:   a = [1,2; 3,4; 5,6; 1,2; 7,8] a = 1 2 3 4 5 6 1 2 7 8 %... ans = 1 2 3 4 5 6 7 8 The order doesn't matter.   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  ,  Finance Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and researc...

How can I draw a circle on an image in MATLAB?

  I have an image in MATLAB:    im = rgb2gray(imread('some_image.jpg'); % normalize the image to be between 0 and 1 im = im/max(max(im)); And I've done some processing that resulted in a number of points that I want to highlight:    points = some_processing(im); Where  points  is a matrix the same size as  im  with ones in the interesting points. Now I want to draw a circle on the image in all the places where  points  is 1. Is there any function in MATLAB that does this? The best I can come up with is:    [x_p, y_p] = find (points); [x, y] = meshgrid(1:size(im,1), 1:size(im,2)) r = 5; circles = zeros(size(im)); for k = 1:length(x_p) circles = circles + (floor((x - x_p(k)).^2 + (y - y_p(k)).^2) == r); end % normalize circles circles = circles/max(max(circles)); output = im + circles; imshow(output) This seems more than somewhat inelegant. Is there a way to draw circles similar to the  line  function?...

Create matrix with random binary element in matlab

  I want to create a matrix in matlab with 500 cell (50 row,10 column ), How I can create and initialize it by random binary digits? I want some thing like this in 50*10 scale as sample 3*4 0 1 1 1 0 0 0 0 1 1 1 1 and after it, how can get decimal equation of any row ? like row 1 is equal 7 in decimal   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  ,  Finance Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.    Answers:  Why not use  randi  to generate random integers?     SEE COMPLETE ANSWER CLICK THE LINK    https://matlabhelpers.com/questions/create-matrix-with-random-binary-element-in-matlab.php

Using Python to replace MATLAB: how to import data?

  I want to use some Python libraries to replace MATLAB. How could I import Excel data in Python (for example using NumPy) to use them? I don't know if Python is a credible alternative to MATLAB, but I want to try it. Is there a a tutorial?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  ,  Finance Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.    Answers:  Depending on what kind of computations you are doing with MATLAB (and on which toolboxes you are using), Python could be a good alternative to MATLAB. Python + NumPy + SciPy + Matplotlib are the right combination to start. For the data, you can, for example...