- 博客(21)
- 资源 (1)
- 收藏
- 关注
原创 matlab中怎么进行曲线拟合/平滑图像/多项式拟合?
如图,数据得到的poly结果是不规则的,无法处理,怎么平滑图像呢?使用polyfit函数用法:polyfit(x,y,n)x是横轴数据,y是纵轴数据,n是拟合的次数,n越高计算量越大x,y都有,如何确定n的值呢?答:借助cftool工具箱进行模拟拟合使用步骤:1.在控制台输入cftool打开工具箱2.修改拟合参数X,Y在下拉框中选择工作区内的变量默认使用PolynomialDegree中是拟合的次数,修改Degree就可以看到下方的蓝色拟合曲线发生变化3.如何判断拟合的效果呢.
2021-04-27 15:09:15 6914 1
原创 leetcode304:二维区域和检索
class NumMatrix { int[][] sums; public NumMatrix(int[][] matrix) { int rows = matrix.length; // 行数 if(rows > 0){ int cols = matrix[0].length; // 列数 sums = new int[rows][cols + 1]; // sums[.
2021-04-25 09:44:34 130
原创 matlab中实现滑动窗口的方法
clc;clear;% 此脚本中对于选取的时间阈值进行判断data = xlsread('整理完的数据.xlsx','9-27X');% 获取SO2均值数据 CO2均值数据[datar,datac] = size(data);avgSO2 = data(:,datac - 1);avgCO2 = data(:,datac); [avgSO2r,avgSO2c] = size(avgSO2); % avgSO2FirstStep=[];% count = 1;for r
2021-04-23 19:42:02 13837 6
原创 如何知道一个excel中有多少个工作表?
问题:一个excel中有多个工作表,并且没有按照sheet+数字的形式默认命名,且电脑里没有VB,因此无法查看代码,那么怎么能够快速知道有多少个工作表呢?随便打开一张工作表,随便点击选中一个单元格,在其中完整输入:=INFO("numfile")就会自动显示sheet数量TIP:确保自己之打开了想要查询sheet数量的excel,默认统计所有打开的excel中sheet总数量。...
2021-04-23 17:33:18 8486
原创 leetcode303:区域和检索
(前缀和的问题)class NumArray { int[] sums; public NumArray(int[] nums) { int len = nums.length; sums = new int[len]; sums[0] = nums[0]; for(int i = 1; i < len; i ++){ sums[i] = sums[i-1] + nums[i];
2021-04-23 09:53:34 102
原创 leetcode289:生命游戏
public class Solution { public void gameOfLife(int[][] board) { int rows = board.length; int cols = board[0].length; // board副本boardCopy int[][] boardCopy = new int[rows][cols]; for(int row = 0; row < rows..
2021-04-22 11:28:38 166
原创 leetcode73:矩阵置零
class Solution { public void setZeroes(int[][] matrix) { int rows = matrix.length; int cols = matrix[0].length; // 创建一个新的矩阵,其中存放标志位,初始值都是0,经过重新赋值零之后,标志位改为1 int[][] flagMatrix = new int[rows][cols]; // 遍历初始矩阵,.
2021-04-21 20:46:10 100
原创 leetcode566:旋转图像
class Solution { public void rotate(int[][] matrix) { // (0,0) -> (0,2) // (0,1) -> (1,2) // (0,2) -> (2,2) // (1,0) -> (0,1) // (1,1) -> (1,1) // (1,2) -> (2,1) // (2,0) -&g.
2021-04-20 21:05:29 88
原创 leetcode566:重塑矩阵
class Solution { public int[][] matrixReshape(int[][] nums, int r, int c) { // 首先判断reshape操作数是否可行合理,通过两者间的元素个数是否相等判断 int countPre = nums.length * nums[0].length; // 原矩阵的元素个数 int countPost = r * c; // 重塑矩阵的元素个数 // 判断.
2021-04-19 09:54:30 128
原创 leetcode498:对角线的遍历
class Solution { public int[] findDiagonalOrder(int[][] matrix) { if (matrix == null || matrix.length == 0) return new int[0]; int m = matrix.length; // 原数组的行数 int n = matrix[0].length; // 原数组的列数 int[] nums = new int[m * n.
2021-04-16 09:14:48 110
原创 leetcode59:螺旋矩阵Ⅱ
class Solution { public int[][] generateMatrix(int n) { // 二维数组规格 int[][] resultArr = new int[n][n]; // 定义四个边界 int up = 0; // 上边界 int bottom = n-1; // 下边界 int left = 0; // 左边界 int right = n-1.
2021-04-15 21:26:14 101
原创 leetcode54:螺旋矩阵
class Solution { public List<Integer> spiralOrder(int[][] matrix) { int m = matrix.length; int n = matrix[0].length; List<Integer> resultList = new ArrayList<>(); // 返回的结果列表 // 定义四个边界 int up ..
2021-04-14 11:57:19 75
原创 leetcode396:旋转数组
class Solution { public int maxRotateFunction(int[] nums) { int n = nums.length; int max = Integer.MIN_VALUE; for(int Fnumber = 0;Fnumber < n;Fnumber ++){ // F(0) ~ F(n-1) int[] reverseArray = new in.
2021-04-13 09:30:33 159
原创 leetcode189:旋转数组
class Solution { public void rotate(int[] nums, int k) { int length = nums.length; //if(k == length) return nums; // 旋转的个数等于数组长度 if(k <= length){ // 旋转个数小于数组长度,旋转个数可能为0个! int[] resultArr = new int[l..
2021-04-12 21:22:26 98
原创 leetcode419:甲板上的战舰
class Solution { public int countBattleships(char[][] board) { int count = 0; for(int row = 0;row < board.length; row ++){ for(int column = 0;column < board[0].length; column ++){ if(board[row][column].
2021-04-12 09:21:23 134
原创 leetcode598:范围求和Ⅱ
class Solution { public int maxCount(int m, int n, int[][] ops) { int[][] originArr = new int[m][n]; // 遍历每一个操作数 for(int index = 0; index < ops.length;index ++){ int[] op = ops[index]; // 获取每一个操作数 i.
2021-04-10 16:14:25 116
原创 leetcode661:图片平滑器
class Solution { public int[][] imageSmoother(int[][] M) { int rowTotal = M.length; int columnTotal = M[0].length; int[][] result = new int[rowTotal][columnTotal]; // 遍历每一个元素, for(int row = 0;row <.
2021-04-09 11:16:24 173
原创 leetcode119:杨辉三角Ⅱ
class Solution { public List<Integer> getRow(int rowIndex) { List<List<Integer>> result = new ArrayList<>(); List<Integer> content = new ArrayList<>(); content.add(1); result.add(con.
2021-04-08 09:35:05 137
原创 leetcode118:杨辉三角
class Solution { public List<List<Integer>> generate(int numRows) { List<List<Integer>> result = new ArrayList<>(); if(numRows == 0){ return result; } List<Integer> conten.
2021-04-07 10:54:11 92
原创 leetcode283:移动零
class Solution { public void moveZeroes(int[] nums) { if(nums != null && nums.length != 0){ int temp = 0; for(int i = 0;i < nums.length - 1;i ++){ if(nums[i] == 0){ int z =.
2021-04-03 10:21:31 91
license.zip
2020-04-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人